commit 08511b5ea5860c51130ba3d7b78f85f8ff9de031 from: Stefan Sperling via: Thomas Adam date: Fri Sep 24 22:01:09 2021 UTC fix 'got send' with tree objects which contain symlinks; reported by Omar commit - 3c9bae70cd3e88013fbc91799ba32e3034495597 commit + 08511b5ea5860c51130ba3d7b78f85f8ff9de031 blob - 49bed139e8532edec677f5d2b18e1f37a1a5746e blob + 4fe546b8b066241ff47803d542c21ebd0c212343 --- lib/pack_create.c +++ lib/pack_create.c @@ -370,8 +370,7 @@ load_tree_entries(struct got_object_id_queue *ids, str break; } - if (got_object_tree_entry_is_symlink(e) || - got_object_tree_entry_is_submodule(e) || + if (got_object_tree_entry_is_submodule(e) || got_object_idset_contains(idset, id)) continue; @@ -387,7 +386,7 @@ load_tree_entries(struct got_object_id_queue *ids, str if (err) break; STAILQ_INSERT_TAIL(ids, qid, entry); - } else if (S_ISREG(mode)) { + } else if (S_ISREG(mode) || S_ISLNK(mode)) { err = add_meta(v, idset, id, p, GOT_OBJ_TYPE_BLOB, mtime, loose_obj_only, repo); if (err) blob - 5fdd09a2185f5b0ec3129d8c2ff58780671c2b0a blob + bf7378666fbaffcdef506f93bd3df20d0c8e454b --- regress/cmdline/send.sh +++ regress/cmdline/send.sh @@ -40,6 +40,10 @@ EOF | tr -d ' ' | cut -d: -f2` echo "modified alpha" > $testroot/repo/alpha + (cd $testroot/repo && git rm -q beta) + (cd $testroot/repo && ln -s epsilon/zeta symlink && git add symlink) + echo "new file alpha" > $testroot/repo/new + (cd $testroot/repo && git add new) git_commit $testroot/repo -m "modified alpha" local commit_id2=`git_show_head $testroot/repo` @@ -94,7 +98,19 @@ EOF >> $testroot/stdout.expected echo "refs/remotes/origin/master: $commit_id" \ >> $testroot/stdout.expected + + cmp -s $testroot/stdout $testroot/stdout.expected + ret="$?" + if [ "$ret" != "0" ]; then + diff -u $testroot/stdout.expected $testroot/stdout + test_done "$testroot" "$ret" + return 1 + fi + got tree -r $testroot/repo-clone -c $commit_id2 -i -R \ + > $testroot/stdout + got tree -r $testroot/repo -c $commit_id2 -i -R \ + > $testroot/stdout.expected cmp -s $testroot/stdout $testroot/stdout.expected ret="$?" if [ "$ret" != "0" ]; then