Download raw body.
ignore unversioned file during 'got rebase -a' etc.
On Tue, Oct 05, 2021 at 01:26:51PM +0200, Stefan Sperling wrote: > While using 'got rebase -a' I've seen output with a very long > list of unversioned files: > > [...] > ? usr.sbin/ypserv/makedbm/obj > ? usr.sbin/ypserv/mkalias/obj > ? usr.sbin/ypserv/mknetid/obj > ? usr.sbin/ypserv/revnetgroup/obj > ? usr.sbin/ypserv/ypinit/obj > ? usr.sbin/ypserv/yppush/obj > ? usr.sbin/ypserv/ypserv/obj > ? usr.sbin/ypserv/ypxfr/obj > ? usr.sbin/ypset/obj > ? usr.sbin/zdump/obj > ? usr.sbin/zic/obj > Rebase of refs/heads/40mhz aborted > Files not merged because an unversioned file was found in the work tree: 1790 > > I could reproduce the issue by adding an unversioned file into the > work tree of relevant regression tests. This makes tests fail because > progress output now includes an unversioned file and the final line: > Files not merged because an unversioned file was found in the work tree: 1 > > This is an undesirable side-effect of my recent changes to interrupt > merges when unversioned files are found. When aborting an operation > any unversioned files are irrelevant and should not be displayed. > The patch below implements this. > > ok? makes sense, ok > diff 90e6e6204014e47bc38fb5bcaf041cfdad190718 /home/stsp/src/got > blob - f3b944325b2e9e0dfa3fa707d7d370eeef408780 > file + got/got.c > --- got/got.c > +++ got/got.c > @@ -8792,6 +8792,19 @@ done: > } > > static const struct got_error * > +abort_progress(void *arg, unsigned char status, const char *path) > +{ > + /* > + * Unversioned files should not clutter progress output when > + * an operation is aborted. > + */ > + if (status == GOT_STATUS_UNVERSIONED) > + return NULL; > + > + return update_progress(arg, status, path); > +} > + > +static const struct got_error * > cmd_rebase(int argc, char *argv[]) > { > const struct got_error *error = NULL; > @@ -8944,7 +8957,7 @@ cmd_rebase(int argc, char *argv[]) > printf("Switching work tree to %s\n", > got_ref_get_symref_target(new_base_branch)); > error = got_worktree_rebase_abort(worktree, fileindex, repo, > - new_base_branch, update_progress, &upa); > + new_base_branch, abort_progress, &upa); > if (error) > goto done; > printf("Rebase of %s aborted\n", got_ref_get_name(branch)); > @@ -9029,7 +9042,7 @@ cmd_rebase(int argc, char *argv[]) > if (pid == NULL) { > if (!continue_rebase) { > error = got_worktree_rebase_abort(worktree, fileindex, > - repo, new_base_branch, update_progress, &upa); > + repo, new_base_branch, abort_progress, &upa); > if (error) > goto done; > printf("Rebase of %s aborted\n", > @@ -10217,7 +10230,7 @@ cmd_histedit(int argc, char *argv[]) > printf("Switching work tree to %s\n", > got_ref_get_symref_target(branch)); > error = got_worktree_histedit_abort(worktree, fileindex, repo, > - branch, base_commit_id, update_progress, &upa); > + branch, base_commit_id, abort_progress, &upa); > if (error) > goto done; > printf("Histedit of %s aborted\n", > @@ -10332,7 +10345,7 @@ cmd_histedit(int argc, char *argv[]) > if (error) { > got_worktree_histedit_abort(worktree, fileindex, > repo, branch, base_commit_id, > - update_progress, &upa); > + abort_progress, &upa); > print_merge_progress_stats(&upa); > goto done; > } > @@ -10347,7 +10360,7 @@ cmd_histedit(int argc, char *argv[]) > if (error) { > got_worktree_histedit_abort(worktree, fileindex, > repo, branch, base_commit_id, > - update_progress, &upa); > + abort_progress, &upa); > print_merge_progress_stats(&upa); > goto done; > } > @@ -10359,7 +10372,7 @@ cmd_histedit(int argc, char *argv[]) > if (error) { > got_worktree_histedit_abort(worktree, fileindex, > repo, branch, base_commit_id, > - update_progress, &upa); > + abort_progress, &upa); > print_merge_progress_stats(&upa); > goto done; > } > @@ -10785,7 +10798,7 @@ cmd_merge(int argc, char *argv[]) > if (error) > goto done; > error = got_worktree_merge_abort(worktree, fileindex, repo, > - update_progress, &upa); > + abort_progress, &upa); > if (error) > goto done; > printf("Merge of %s aborted\n", branch_name); > @@ -10870,7 +10883,7 @@ cmd_merge(int argc, char *argv[]) > print_merge_progress_stats(&upa); > if (!upa.did_something) { > error = got_worktree_merge_abort(worktree, fileindex, > - repo, update_progress, &upa); > + repo, abort_progress, &upa); > if (error) > goto done; > printf("Already up-to-date\n"); > blob - 65ef292945ab5a14c0c1674cbd8aec70fc5e9418 > file + regress/cmdline/histedit.sh > --- regress/cmdline/histedit.sh > +++ regress/cmdline/histedit.sh > @@ -833,6 +833,9 @@ test_histedit_abort() { > return 1 > fi > > + # unrelated unversioned file in work tree > + touch $testroot/wt/unversioned-file > + > echo "edit $old_commit1" > $testroot/histedit-script > echo "mesg committing changes" >> $testroot/histedit-script > echo "pick $old_commit2" >> $testroot/histedit-script > @@ -904,6 +907,7 @@ test_histedit_abort() { > (cd $testroot/wt && got status > $testroot/stdout) > > echo "? epsilon/new" > $testroot/stdout.expected > + echo "? unversioned-file" >> $testroot/stdout.expected > cmp -s $testroot/stdout.expected $testroot/stdout > ret="$?" > if [ "$ret" != "0" ]; then > blob - be7e58787cda7e3de992a5142542bebcf76ab385 > file + regress/cmdline/merge.sh > --- regress/cmdline/merge.sh > +++ regress/cmdline/merge.sh > @@ -622,6 +622,9 @@ test_merge_abort() { > return 1 > fi > > + # unrelated unversioned file in work tree > + touch $testroot/wt/unversioned-file > + > # create a conflicting commit > (cd $testroot/repo && git checkout -q master) > echo "modified alpha on master" > $testroot/repo/alpha > @@ -677,6 +680,7 @@ test_merge_abort() { > echo "A epsilon/new" >> $testroot/stdout.expected > echo "M gamma/delta" >> $testroot/stdout.expected > echo "A symlink" >> $testroot/stdout.expected > + echo "? unversioned-file" >> $testroot/stdout.expected > cmp -s $testroot/stdout.expected $testroot/stdout > ret="$?" > if [ "$ret" != "0" ]; then > @@ -753,7 +757,7 @@ test_merge_abort() { > > (cd $testroot/wt && got status > $testroot/stdout) > > - echo -n "" > $testroot/stdout.expected > + echo "? unversioned-file" > $testroot/stdout.expected > cmp -s $testroot/stdout.expected $testroot/stdout > ret="$?" > if [ "$ret" != "0" ]; then > blob - 8ca3370f2ac372e3923bb4199f6774b6159e3ec5 > file + regress/cmdline/rebase.sh > --- regress/cmdline/rebase.sh > +++ regress/cmdline/rebase.sh > @@ -424,6 +424,9 @@ test_rebase_abort() { > return 1 > fi > > + # unrelated unversioned file in work tree > + touch $testroot/wt/unversioned-file > + > (cd $testroot/wt && got rebase newbranch > $testroot/stdout \ > 2> $testroot/stderr) > > @@ -471,6 +474,7 @@ test_rebase_abort() { > (cd $testroot/wt && got status > $testroot/stdout) > > echo "C alpha" > $testroot/stdout.expected > + echo "? unversioned-file" >> $testroot/stdout.expected > cmp -s $testroot/stdout.expected $testroot/stdout > ret="$?" > if [ "$ret" != "0" ]; then >
ignore unversioned file during 'got rebase -a' etc.