commit - 90de04bc7f1b85b9c491bcd124f6178fad005de1
commit + 10a623dfc23b47f494941e0eac741420c08372a3
blob - 323461bc8c40befe6cb69f4cab726725833fff59
blob + 488cd9f35722bed936af6e7d9e2c6aa77ea2a3d8
--- 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 - 9180f57976107c762edd140fcaa6e736a9fb2f77
blob + 7f88ca162b03984f506ec0612d4004a03f86c25f
--- 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 - 9766243def1b9ea970812bb138d4d8aeda056a96
blob + 608abc82cbefff93d4d24717552a9b9a1f703761
--- 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 - de94a6e129b914a487c98dde2b1cc0d59698c4cd
blob + 8b67476fd9377314c10033f7fe555651af4cda1a
--- 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 - 946422e07ecfbb970b7b9f9264e7ee67e4b62d55
blob + d064dee9ea07f4c1490ffd37ad9aed281f7f6cb0
--- 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