Skip to content

Commit

Permalink
Merge branch 'maint'
Browse files Browse the repository at this point in the history
* maint:
  t9350: fix careless use of "cd"
  difftool: Fix '--gui' when diff.guitool is unconfigured
  fast-export: don't segfault when marks file cannot be opened
  • Loading branch information
Junio C Hamano committed Mar 29, 2010
2 parents 10439d8 + 4c367c6 commit faf7526
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 39 deletions.
2 changes: 1 addition & 1 deletion builtin/fast-export.c
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ static void export_marks(char *file)

f = fopen(file, "w");
if (!f)
error("Unable to open marks file %s for writing.", file);
die_errno("Unable to open marks file %s for writing.", file);

for (i = 0; i < idnums.size; i++) {
if (deco->base && deco->base->type == 1) {
Expand Down
12 changes: 7 additions & 5 deletions git-difftool.perl
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,13 @@ sub generate_command
next;
}
if ($arg eq '-g' || $arg eq '--gui') {
my $tool = Git::command_oneline('config',
'diff.guitool');
if (length($tool)) {
$ENV{GIT_DIFF_TOOL} = $tool;
}
eval {
my $tool = Git::command_oneline('config',
'diff.guitool');
if (length($tool)) {
$ENV{GIT_DIFF_TOOL} = $tool;
}
};
next;
}
if ($arg eq '-y' || $arg eq '--no-prompt') {
Expand Down
9 changes: 9 additions & 0 deletions t/t7800-difftool.sh
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,15 @@ test_expect_success 'difftool honors --gui' '
restore_test_defaults
'

test_expect_success 'difftool --gui works without configured diff.guitool' '
git config diff.tool test-tool &&
diff=$(git difftool --no-prompt --gui branch) &&
test "$diff" = "branch" &&
restore_test_defaults
'

# Specify the diff tool using $GIT_DIFF_TOOL
test_expect_success 'GIT_DIFF_TOOL variable' '
git config --unset diff.tool
Expand Down
71 changes: 38 additions & 33 deletions t/t9350-fast-export.sh
Original file line number Diff line number Diff line change
Expand Up @@ -150,20 +150,22 @@ test_expect_success 'setup submodule' '
git checkout -f master &&
mkdir sub &&
cd sub &&
git init &&
echo test file > file &&
git add file &&
git commit -m sub_initial &&
cd .. &&
(
cd sub &&
git init &&
echo test file > file &&
git add file &&
git commit -m sub_initial
) &&
git submodule add "`pwd`/sub" sub &&
git commit -m initial &&
test_tick &&
cd sub &&
echo more data >> file &&
git add file &&
git commit -m sub_second &&
cd .. &&
(
cd sub &&
echo more data >> file &&
git add file &&
git commit -m sub_second
) &&
git add sub &&
git commit -m second
Expand Down Expand Up @@ -264,19 +266,20 @@ test_expect_success 'cope with tagger-less tags' '

test_expect_success 'setup for limiting exports by PATH' '
mkdir limit-by-paths &&
cd limit-by-paths &&
git init &&
echo hi > there &&
git add there &&
git commit -m "First file" &&
echo foo > bar &&
git add bar &&
git commit -m "Second file" &&
git tag -a -m msg mytag &&
echo morefoo >> bar &&
git add bar &&
git commit -m "Change to second file" &&
cd ..
(
cd limit-by-paths &&
git init &&
echo hi > there &&
git add there &&
git commit -m "First file" &&
echo foo > bar &&
git add bar &&
git commit -m "Second file" &&
git tag -a -m msg mytag &&
echo morefoo >> bar &&
git add bar &&
git commit -m "Change to second file"
)
'

cat > limit-by-paths/expected << EOF
Expand All @@ -297,10 +300,11 @@ M 100644 :1 there
EOF

test_expect_success 'dropping tag of filtered out object' '
(
cd limit-by-paths &&
git fast-export --tag-of-filtered-object=drop mytag -- there > output &&
test_cmp output expected &&
cd ..
test_cmp output expected
)
'

cat >> limit-by-paths/expected << EOF
Expand All @@ -313,10 +317,11 @@ msg
EOF

test_expect_success 'rewriting tag of filtered out object' '
(
cd limit-by-paths &&
git fast-export --tag-of-filtered-object=rewrite mytag -- there > output &&
test_cmp output expected &&
cd ..
test_cmp output expected
)
'

cat > limit-by-paths/expected << EOF
Expand All @@ -343,13 +348,13 @@ M 100644 :2 there
EOF

test_expect_failure 'no exact-ref revisions included' '
cd limit-by-paths &&
git fast-export master~2..master~1 > output &&
test_cmp output expected &&
cd ..
(
cd limit-by-paths &&
git fast-export master~2..master~1 > output &&
test_cmp output expected
)
'


test_expect_success 'set-up a few more tags for tag export tests' '
git checkout -f master &&
HEAD_TREE=`git show -s --pretty=raw HEAD | grep tree | sed "s/tree //"` &&
Expand Down

0 comments on commit faf7526

Please sign in to comment.