Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove quotes from TIG_LS_REMOTE to allow inline shell commands #1161

Merged
merged 1 commit into from
Nov 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/refdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ reload_refs(bool force)
int argc = 0;

string_ncopy(ls_remote_cmd, env, strlen(env));
if (!argv_from_string(ls_remote_argv, &argc, ls_remote_cmd))
if (!argv_from_string_no_quotes(ls_remote_argv, &argc, ls_remote_cmd))
return error("Failed to parse TIG_LS_REMOTE: %s", env);
}

Expand Down
55 changes: 55 additions & 0 deletions test/refs/filter-test
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/bin/sh
#
# Test ref filtering (GitHub issue #1160)

. libtest.sh
. libgit.sh

export LINES=9
export COLUMNS=120

git_init

test_setup_work_dir() {
git_commit --allow-empty -m Initial\ commit
git branch my-branch1 HEAD
git branch my-branch2 HEAD
git update-ref refs/remotes/origin/my-branch1 HEAD
git update-ref refs/remotes/origin/my-branch2 HEAD
git tag my-tag1 HEAD
git tag my-tag2 HEAD
git update-ref refs/my-raw-ref1 HEAD
git update-ref refs/my-raw-ref2 HEAD
}

export TIG_LS_REMOTE='sh -c "git show-ref --head --dereference | grep -v refs/.\\*1"'

steps '
:save-display main.screen
:view-refs
:save-display refs.screen
'

test_tig

assert_equals 'main.screen' <<EOF
2009-02-13 23:31 +0000 Committer I [master] [my-branch2] [refs/my-raw-ref2] {origin/my-branch2} <my-tag2> Initial commit






[main] 174877369ea7af366da2ebcedd63d7a00d8046ea - commit 1 of 1 100%
EOF

assert_equals 'refs.screen' <<EOF
All references
master
my-branch2
refs/my-raw-ref2
origin/my-branch2
my-tag2

[refs] All references 100%
EOF