commit - e7011650f26a2d1b18df28dcfb280ff8144ce08a
commit + aaf972e2369e5926a83162de108b6826f44e4a48
blob - f1730de3eef8aceb312d7ffbd72f6f102611ec16
blob + 7a7742772cf995f9d64acb1ade8a8c5d7269b722
--- lib/worktree.c
+++ lib/worktree.c
static const struct got_error *
create_fileindex_entry(struct got_fileindex_entry **new_iep,
struct got_fileindex *fileindex, struct got_object_id *base_commit_id,
- int wt_fd, const char *path, struct got_object_id *blob_id)
+ int wt_fd, const char *path, struct got_object_id *blob_id,
+ int update_timestamps)
{
const struct got_error *err = NULL;
struct got_fileindex_entry *new_ie;
return err;
err = got_fileindex_entry_update(new_ie, wt_fd, path,
- blob_id->sha1, base_commit_id->sha1, 1);
+ blob_id->sha1, base_commit_id->sha1, update_timestamps);
if (err)
goto done;
const char *path, mode_t te_mode, mode_t st_mode,
struct got_blob_object *blob, int restoring_missing_file,
int reverting_versioned_file, int installing_bad_symlink,
- int path_is_unversioned, struct got_repository *repo,
+ int path_is_unversioned, int *update_timestamps,
+ struct got_repository *repo,
got_worktree_checkout_cb progress_cb, void *progress_arg);
/*
return install_blob(worktree, ondisk_path, path,
GOT_DEFAULT_FILE_MODE, GOT_DEFAULT_FILE_MODE, blob,
restoring_missing_file, reverting_versioned_file,
- 1, path_is_unversioned, repo, progress_cb,
+ 1, path_is_unversioned, NULL, repo, progress_cb,
progress_arg);
}
if (len > 0) {
err = install_blob(worktree, ondisk_path, path,
GOT_DEFAULT_FILE_MODE, GOT_DEFAULT_FILE_MODE, blob,
restoring_missing_file, reverting_versioned_file, 1,
- path_is_unversioned, repo, progress_cb, progress_arg);
+ path_is_unversioned, NULL, repo,
+ progress_cb, progress_arg);
return err;
}
err = install_blob(worktree, ondisk_path, path,
GOT_DEFAULT_FILE_MODE, GOT_DEFAULT_FILE_MODE, blob,
restoring_missing_file, reverting_versioned_file, 1,
- path_is_unversioned, repo,
+ path_is_unversioned, NULL, repo,
progress_cb, progress_arg);
} else if (errno == ENOTDIR) {
err = got_error_path(ondisk_path,
const char *path, mode_t te_mode, mode_t st_mode,
struct got_blob_object *blob, int restoring_missing_file,
int reverting_versioned_file, int installing_bad_symlink,
- int path_is_unversioned, struct got_repository *repo,
+ int path_is_unversioned, int *update_timestamps,
+ struct got_repository *repo,
got_worktree_checkout_cb progress_cb, void *progress_arg)
{
const struct got_error *err = NULL;
int update = 0;
char *tmppath = NULL;
mode_t mode;
+
+ if (update_timestamps)
+ *update_timestamps = 1;
mode = get_ondisk_perms(te_mode & S_IXUSR, GOT_DEFAULT_FILE_MODE);
fd = open(ondisk_path, O_RDWR | O_CREAT | O_EXCL | O_NOFOLLOW |
ondisk_path);
} else if (errno == EEXIST) {
if (path_is_unversioned) {
+ if (update_timestamps)
+ *update_timestamps = 0;
err = (*progress_cb)(progress_arg,
- GOT_STATUS_UNVERSIONED, path);
+ GOT_STATUS_EXISTS, path);
goto done;
}
if (!(S_ISLNK(st_mode) && S_ISREG(te_mode)) &&
unsigned char status = GOT_STATUS_NO_CHANGE;
struct stat sb;
int fd1 = -1, fd2 = -1;
+ int update_timestamps;
if (asprintf(&ondisk_path, "%s/%s", worktree->root_path, path) == -1)
return got_error_from_errno("asprintf");
err = install_blob(worktree, ondisk_path, path,
te->mode, sb.st_mode, blob,
status == GOT_STATUS_MISSING, 0, 0,
- status == GOT_STATUS_UNVERSIONED, repo,
- progress_cb, progress_arg);
+ status == GOT_STATUS_UNVERSIONED,
+ &update_timestamps,
+ repo, progress_cb, progress_arg);
}
if (err)
goto done;
} else {
err = create_fileindex_entry(&ie, fileindex,
worktree->base_commit_id, worktree->root_fd, path,
- &blob->id);
+ &blob->id, update_timestamps);
}
if (err)
goto done;
err = install_blob(worktree, ondisk_path, path2,
mode2, GOT_DEFAULT_FILE_MODE, blob2,
restoring_missing_file, reverting_versioned_file, 0,
- path_is_unversioned, repo, progress_cb, progress_arg);
+ path_is_unversioned, NULL, repo,
+ progress_cb, progress_arg);
}
if (err)
return err;
ie->path,
te ? te->mode : GOT_DEFAULT_FILE_MODE,
got_fileindex_perms_to_st(ie), blob,
- 0, 1, 0, 0, a->repo,
+ 0, 1, 0, 0, NULL, a->repo,
a->progress_cb, a->progress_arg);
}
if (err)
blob - 642aa7ff0a7ff201dae5e22b59ce99b7e725eced
blob + 95f34afe31e5991bc2dfc22ad99e44cdd23832cc
--- regress/cmdline/checkout.sh
+++ regress/cmdline/checkout.sh
return 1
fi
- echo "? $testroot/wt/alpha" > $testroot/stdout.expected
- echo "? $testroot/wt/beta" >> $testroot/stdout.expected
- echo "? $testroot/wt/epsilon/zeta" >> $testroot/stdout.expected
- echo "? $testroot/wt/gamma/delta" >> $testroot/stdout.expected
+ echo "E $testroot/wt/alpha" > $testroot/stdout.expected
+ echo "E $testroot/wt/beta" >> $testroot/stdout.expected
+ echo "E $testroot/wt/epsilon/zeta" >> $testroot/stdout.expected
+ echo "E $testroot/wt/gamma/delta" >> $testroot/stdout.expected
echo "Checked out refs/heads/master: $commit_id" \
>> $testroot/stdout.expected
echo "Now shut up and hack" >> $testroot/stdout.expected
return 1
fi
- echo "modified alpha" > $testroot/wt/alpha
+ # retry, but with alpha modified
+
+ rm -rf "$testroot/wt/.got"
+ echo modified alpha >$testroot/wt/alpha
echo "E $testroot/wt/alpha" > $testroot/stdout.expected
echo "E $testroot/wt/beta" >> $testroot/stdout.expected