commit - b6c8e5e0edc57f309ae866114527e614ad0cd76d
commit + f1417e9f1c817d4e11dba207cf39ae12ffda2138
blob - 2be25dcb77a5de665eafc583c2cc07ac9f6d4025
blob + 02099e4c91aac5a1e9d1803898d1c74c33234d0d
--- got/got.c
+++ got/got.c
{
const struct got_error *err = NULL;
char *path;
+ struct got_pathlist_entry *new;
int i;
if (argc == 0) {
err = got_worktree_resolve_path(&path, worktree, argv[i]);
if (err)
break;
- err = got_pathlist_append(paths, path, NULL);
- if (err) {
+ err = got_pathlist_insert(&new, paths, path, NULL);
+ if (err || new == NULL /* duplicate */) {
free(path);
- break;
+ if (err)
+ break;
}
}
blob - 0b8274bf499788e7fa6712a4346be0ea1a745883
blob + e59e019d01dee6cf8c0d851c8d4b5ed6beb5c176
--- regress/cmdline/add.sh
+++ regress/cmdline/add.sh
return 1
fi
- echo "A foo" > $testroot/stdout.expected
- echo "A bar" >> $testroot/stdout.expected
+ echo "A bar" > $testroot/stdout.expected
echo "A baz" >> $testroot/stdout.expected
+ echo "A foo" >> $testroot/stdout.expected
cmp -s $testroot/stdout.expected $testroot/stdout
ret="$?"
blob - 24e167624a9dff80bfc3ea53ddfcfe092ffd80d6
blob + 4761c1d807aa6e3b17fe877f1423d26a8f7465b2
--- regress/cmdline/diff.sh
+++ regress/cmdline/diff.sh
# diff several paths in a work tree
echo "diff $head_rev $testroot/wt" > $testroot/stdout.expected
- echo 'blob - /dev/null' >> $testroot/stdout.expected
- echo 'file + new' >> $testroot/stdout.expected
- echo '--- /dev/null' >> $testroot/stdout.expected
- echo '+++ new' >> $testroot/stdout.expected
- echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
- echo '+new file' >> $testroot/stdout.expected
echo -n 'blob - ' >> $testroot/stdout.expected
got tree -r $testroot/repo -i | grep 'alpha$' | cut -d' ' -f 1 \
>> $testroot/stdout.expected
echo '-alpha' >> $testroot/stdout.expected
echo '+modified alpha' >> $testroot/stdout.expected
echo -n 'blob - ' >> $testroot/stdout.expected
+ got tree -r $testroot/repo -i | grep 'beta$' | cut -d' ' -f 1 \
+ >> $testroot/stdout.expected
+ echo 'file + /dev/null' >> $testroot/stdout.expected
+ echo '--- beta' >> $testroot/stdout.expected
+ echo '+++ /dev/null' >> $testroot/stdout.expected
+ echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected
+ echo '-beta' >> $testroot/stdout.expected
+ echo -n 'blob - ' >> $testroot/stdout.expected
got tree -r $testroot/repo -i epsilon | grep 'zeta$' | cut -d' ' -f 1 \
>> $testroot/stdout.expected
echo 'file + epsilon/zeta' >> $testroot/stdout.expected
echo '@@ -1 +1 @@' >> $testroot/stdout.expected
echo '-zeta' >> $testroot/stdout.expected
echo '+modified zeta' >> $testroot/stdout.expected
- echo -n 'blob - ' >> $testroot/stdout.expected
- got tree -r $testroot/repo -i | grep 'beta$' | cut -d' ' -f 1 \
- >> $testroot/stdout.expected
- echo 'file + /dev/null' >> $testroot/stdout.expected
- echo '--- beta' >> $testroot/stdout.expected
- echo '+++ /dev/null' >> $testroot/stdout.expected
- echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected
- echo '-beta' >> $testroot/stdout.expected
+ echo 'blob - /dev/null' >> $testroot/stdout.expected
+ echo 'file + new' >> $testroot/stdout.expected
+ echo '--- /dev/null' >> $testroot/stdout.expected
+ echo '+++ new' >> $testroot/stdout.expected
+ echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
+ echo '+new file' >> $testroot/stdout.expected
(cd $testroot/wt && got diff new alpha epsilon beta > $testroot/stdout)
cmp -s $testroot/stdout.expected $testroot/stdout
return 1
fi
- # a branch 'new' should not collide with path 'new' if more
- # than two arguments are passed
- got br -r $testroot/repo -c master new > /dev/null
- (cd $testroot/wt && got diff new alpha epsilon beta \
+ # different order of arguments results in same output order
+ (cd $testroot/wt && got diff alpha new epsilon beta \
> $testroot/stdout 2> $testroot/stderr)
ret="$?"
if [ "$ret" != "0" ]; then
return 1
fi
- # different order of arguments results in different output order
- echo "diff $head_rev $testroot/wt" > $testroot/stdout.expected
- echo -n 'blob - ' >> $testroot/stdout.expected
- got tree -r $testroot/repo -i | grep 'alpha$' | cut -d' ' -f 1 \
- >> $testroot/stdout.expected
- echo 'file + alpha' >> $testroot/stdout.expected
- echo '--- alpha' >> $testroot/stdout.expected
- echo '+++ alpha' >> $testroot/stdout.expected
- echo '@@ -1 +1 @@' >> $testroot/stdout.expected
- echo '-alpha' >> $testroot/stdout.expected
- echo '+modified alpha' >> $testroot/stdout.expected
- echo 'blob - /dev/null' >> $testroot/stdout.expected
- echo 'file + new' >> $testroot/stdout.expected
- echo '--- /dev/null' >> $testroot/stdout.expected
- echo '+++ new' >> $testroot/stdout.expected
- echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
- echo '+new file' >> $testroot/stdout.expected
- echo -n 'blob - ' >> $testroot/stdout.expected
- got tree -r $testroot/repo -i epsilon | grep 'zeta$' | cut -d' ' -f 1 \
- >> $testroot/stdout.expected
- echo 'file + epsilon/zeta' >> $testroot/stdout.expected
- echo '--- epsilon/zeta' >> $testroot/stdout.expected
- echo '+++ epsilon/zeta' >> $testroot/stdout.expected
- echo '@@ -1 +1 @@' >> $testroot/stdout.expected
- echo '-zeta' >> $testroot/stdout.expected
- echo '+modified zeta' >> $testroot/stdout.expected
- echo -n 'blob - ' >> $testroot/stdout.expected
- got tree -r $testroot/repo -i | grep 'beta$' | cut -d' ' -f 1 \
- >> $testroot/stdout.expected
- echo 'file + /dev/null' >> $testroot/stdout.expected
- echo '--- beta' >> $testroot/stdout.expected
- echo '+++ /dev/null' >> $testroot/stdout.expected
- echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected
- echo '-beta' >> $testroot/stdout.expected
- (cd $testroot/wt && got diff alpha new epsilon beta \
+ # a branch 'new' should not collide with path 'new' if more
+ # than two arguments are passed
+ got br -r $testroot/repo -c master new > /dev/null
+ (cd $testroot/wt && got diff new alpha epsilon beta \
> $testroot/stdout 2> $testroot/stderr)
ret="$?"
if [ "$ret" != "0" ]; then
fi
echo "diff $head_rev $testroot/wt" > $testroot/stdout.expected
echo 'blob - /dev/null' >> $testroot/stdout.expected
- echo 'file + new' >> $testroot/stdout.expected
- echo '--- /dev/null' >> $testroot/stdout.expected
- echo '+++ new' >> $testroot/stdout.expected
- echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
- echo '+new file' >> $testroot/stdout.expected
- echo 'blob - /dev/null' >> $testroot/stdout.expected
echo 'file + master' >> $testroot/stdout.expected
echo '--- /dev/null' >> $testroot/stdout.expected
echo '+++ master' >> $testroot/stdout.expected
echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
echo '+master' >> $testroot/stdout.expected
+ echo 'blob - /dev/null' >> $testroot/stdout.expected
+ echo 'file + new' >> $testroot/stdout.expected
+ echo '--- /dev/null' >> $testroot/stdout.expected
+ echo '+++ new' >> $testroot/stdout.expected
+ echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
+ echo '+new file' >> $testroot/stdout.expected
cmp -s $testroot/stdout.expected $testroot/stdout
ret="$?"
if [ "$ret" != "0" ]; then
fi
# three arguments imply use of path filtering (work tree case)
- (cd $testroot/wt && got diff $commit_id0 $commit_id1 foo \
+ (cd $testroot/wt && got diff $commit_id0 master foo \
2> $testroot/stderr)
ret="$?"
if [ "$ret" == "0" ]; then
blob - d8ebff4da2318e250b48af48107b4239b2b982c9
blob + 549ce74297e453fcd8242a38b3d10f6f78fb17d7
--- regress/cmdline/revert.sh
+++ regress/cmdline/revert.sh
cat > $testroot/stdout.expected <<EOF
R alpha.link
-R epsilon.link
-R passwd.link
R epsilon/beta.link
+R epsilon.link
+R new.link
R nonexistent.link
+R passwd.link
R zeta.link
-R new.link
EOF
cmp -s $testroot/stdout.expected $testroot/stdout
ret="$?"
blob - 51dea1da6173dd6abe8666612459b839ee497013
blob + cab753f3139225f2518ae82f6ba928625c46e9e6
--- regress/cmdline/rm.sh
+++ regress/cmdline/rm.sh
fi
echo 'D alpha.link' > $testroot/stdout.expected
- echo 'D epsilon.link' >> $testroot/stdout.expected
- echo 'D passwd.link' >> $testroot/stdout.expected
echo 'D epsilon/beta.link' >> $testroot/stdout.expected
+ echo 'D epsilon.link' >> $testroot/stdout.expected
echo 'D nonexistent.link' >> $testroot/stdout.expected
+ echo 'D passwd.link' >> $testroot/stdout.expected
(cd $testroot/wt && got rm alpha.link epsilon.link passwd.link \
epsilon/beta.link nonexistent.link > $testroot/stdout)
blob - 617773180b2eca26860783dcbc63d506914059e2
blob + 1768e16b391b7e17123333e6557cfd1a8ff913a3
--- regress/cmdline/status.sh
+++ regress/cmdline/status.sh
mkdir $testroot/wt/newdir
(cd $testroot/wt && got add new >/dev/null)
- (cd $testroot/wt && got status newdir > $testroot/stdout.expected)
- (cd $testroot/wt && got status alpha >> $testroot/stdout.expected)
+ (cd $testroot/wt && got status alpha > $testroot/stdout.expected)
+ (cd $testroot/wt && got status beta >> $testroot/stdout.expected)
(cd $testroot/wt && got status epsilon >> $testroot/stdout.expected)
(cd $testroot/wt && got status foo >> $testroot/stdout.expected)
(cd $testroot/wt && got status new >> $testroot/stdout.expected)
- (cd $testroot/wt && got status beta >> $testroot/stdout.expected)
+ (cd $testroot/wt && got status newdir >> $testroot/stdout.expected)
(cd $testroot/wt && got status . >> $testroot/stdout.expected)
(cd $testroot/wt && got status newdir alpha epsilon foo new beta . \
blob - 2a7545564f078c5d130856c1ee10bc042b9e44f1
blob + 5d6ef1de516952ff8423025457c87352fb8ed55e
--- regress/cmdline/update.sh
+++ regress/cmdline/update.sh
(cd $testroot/repo && git add .)
git_commit $testroot/repo -m "added two files"
- echo "A new" > $testroot/stdout.expected
- echo "A epsilon/new2" >> $testroot/stdout.expected
+ echo "A epsilon/new2" > $testroot/stdout.expected
+ echo "A new" >> $testroot/stdout.expected
echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
git_show_head $testroot/repo >> $testroot/stdout.expected
echo >> $testroot/stdout.expected