Repository: dolthub/dolt
File: go/store/datas/pull/clone.go (Go)

Code before:
		}
		if failureCount >= maxAttempts {
			return err
		}
		if _, refreshedSourceFiles, refreshedAppendixFiles, err := srcTS.Sources(ctx); err != nil {
			return err
		} else {
			refreshedTblFiles := filterAppendicesFromSourceFiles(refreshedAppendixFiles, refreshedSourceFiles)
			_, refreshedFileIDToTF, _ := mapTableFiles(refreshedTblFiles)
			// Sources() will refresh remote table file
			// sources with new download URLs. However, it
			// will only return URLs for table files which
			// are in the remote manifest, which could
			// have changed since the clone started. Here
			// we keep around any old TableFile instances
			// for any TableFiles which have been
			// conjoined away or have been the victim of a
			// garbage collection run on the remote.
			//
			// If these files are no longer accessible,
			// for example because the URLs expired
			// without a RefreshTableFileUrlRequest being
			// provided, or because the table files
			// themselves have been removed from storage,
			// then continuing to use these sources will
			// fail termainally eventually. But in the
			// case of doltremoteapi on DoltHub, using
			// these Sources() will continue to work and
			// will allow the Clone to proceed.
			for k, v := range refreshedFileIDToTF {
				fileIDToTF[k] = v
			}
		}
	}

	err = sinkTS.AddTableFilesToManifest(ctx, fileIDToNumChunks, getAddrs)
	if err != nil {
		return err
	}

	// AddTableFilesToManifest can set the root chunk if there is a chunk
	// journal which we downloaded in the clone. If that happened, the
	// chunk journal is actually more accurate on what the current root is
	// than the result of |Sources| up above. We choose not to touch
	// anything in that case.
	err = sinkCS.Rebase(ctx)
	if err != nil {
		return err
	}
	sinkRoot, err := sinkCS.Root(ctx)
	if err != nil {

Review comment (bug):
```suggestion
			// fail terminally eventually. But in the
```

Code after:
		}
		if failureCount >= maxAttempts {
			return err
		}
		if _, refreshedSourceFiles, refreshedAppendixFiles, err := srcTS.Sources(ctx); err != nil {
			return err
		} else {
			refreshedTblFiles := filterAppendicesFromSourceFiles(refreshedAppendixFiles, refreshedSourceFiles)
			_, refreshedFileIDToTF, _ := mapTableFiles(refreshedTblFiles)
			// Sources() will refresh remote table file
			// sources with new download URLs. However, it
			// will only return URLs for table files which
			// are in the remote manifest, which could
			// have changed since the clone started. Here
			// we keep around any old TableFile instances
			// for any TableFiles which have been
			// conjoined away or have been the victim of a
			// garbage collection run on the remote.
			//
			// If these files are no longer accessible,
			// for example because the URLs expired
			// without a RefreshTableFileUrlRequest being
			// provided, or because the table files
			// themselves have been removed from storage,
			// then continuing to use these sources will
			// fail terminally eventually. But in the
			// case of doltremoteapi on DoltHub, using
			// these Sources() will continue to work and
			// will allow the Clone to proceed.
			for k, v := range refreshedFileIDToTF {
				fileIDToTF[k] = v
			}
		}
	}

	err = sinkTS.AddTableFilesToManifest(ctx, fileIDToNumChunks, getAddrs)
	if err != nil {
		return err
	}

	// AddTableFilesToManifest can set the root chunk if there is a chunk
	// journal which we downloaded in the clone. If that happened, the
	// chunk journal is actually more accurate on what the current root is
	// than the result of |Sources| up above. We choose not to touch
	// anything in that case.
	err = sinkCS.Rebase(ctx)
	if err != nil {
		return err
	}
	sinkRoot, err := sinkCS.Root(ctx)
	if err != nil {