* [RFC PATCH 3/3] git p4: use "git p4" directly in tests
From: Pete Wyckoff @ 2012-02-12 18:13 UTC (permalink / raw)
To: git; +Cc: Luke Diamand, Vitor Antunes
In-Reply-To: <1329070423-23761-1-git-send-email-pw@padd.com>
Drop the $GITP4 variable that was used to specify the script in
contrib/fast-import/. The command is called "git p4" now, not
"git-p4". Variables will remain in a section called "git-p4".
Signed-off-by: Pete Wyckoff <pw@padd.com>
---
t/lib-git-p4.sh | 8 +--
t/t9800-git-p4-basic.sh | 84 ++++++++++++++++++------------------
t/t9801-git-p4-branch.sh | 32 +++++++-------
t/t9802-git-p4-filetype.sh | 10 ++--
t/t9803-git-p4-shell-metachars.sh | 12 +++---
t/t9804-git-p4-label.sh | 6 +-
t/t9805-git-p4-skip-submit-edit.sh | 22 +++++-----
t/t9806-git-p4-options.sh | 28 ++++++------
t/t9807-git-p4-submit.sh | 22 +++++-----
t/t9808-git-p4-chdir.sh | 6 +-
t/t9809-git-p4-client-view.sh | 64 ++++++++++++++--------------
11 files changed, 146 insertions(+), 148 deletions(-)
diff --git a/t/lib-git-p4.sh b/t/lib-git-p4.sh
index 49edaae..b90986c 100644
--- a/t/lib-git-p4.sh
+++ b/t/lib-git-p4.sh
@@ -1,20 +1,18 @@
#
-# Library code for git-p4 tests
+# Library code for git p4 tests
#
. ./test-lib.sh
if ! test_have_prereq PYTHON; then
- skip_all='skipping git-p4 tests; python not available'
+ skip_all='skipping git p4 tests; python not available'
test_done
fi
( p4 -h && p4d -h ) >/dev/null 2>&1 || {
- skip_all='skipping git-p4 tests; no p4 or p4d'
+ skip_all='skipping git p4 tests; no p4 or p4d'
test_done
}
-GITP4="$GIT_BUILD_DIR/git-p4"
-
# Try to pick a unique port: guess a large number, then hope
# no more than one of each test is running.
#
diff --git a/t/t9800-git-p4-basic.sh b/t/t9800-git-p4-basic.sh
index 04ee20e..36a7603 100755
--- a/t/t9800-git-p4-basic.sh
+++ b/t/t9800-git-p4-basic.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-test_description='git-p4 tests'
+test_description='git p4 tests'
. ./lib-git-p4.sh
@@ -20,8 +20,8 @@ test_expect_success 'add p4 files' '
)
'
-test_expect_success 'basic git-p4 clone' '
- "$GITP4" clone --dest="$git" //depot &&
+test_expect_success 'basic git p4 clone' '
+ git p4 clone --dest="$git" //depot &&
test_when_finished cleanup_git &&
(
cd "$git" &&
@@ -30,8 +30,8 @@ test_expect_success 'basic git-p4 clone' '
)
'
-test_expect_success 'git-p4 clone @all' '
- "$GITP4" clone --dest="$git" //depot@all &&
+test_expect_success 'git p4 clone @all' '
+ git p4 clone --dest="$git" //depot@all &&
test_when_finished cleanup_git &&
(
cd "$git" &&
@@ -40,12 +40,12 @@ test_expect_success 'git-p4 clone @all' '
)
'
-test_expect_success 'git-p4 sync uninitialized repo' '
+test_expect_success 'git p4 sync uninitialized repo' '
test_create_repo "$git" &&
test_when_finished cleanup_git &&
(
cd "$git" &&
- test_must_fail "$GITP4" sync
+ test_must_fail git p4 sync
)
'
@@ -53,13 +53,13 @@ test_expect_success 'git-p4 sync uninitialized repo' '
# Create a git repo by hand. Add a commit so that HEAD is valid.
# Test imports a new p4 repository into a new git branch.
#
-test_expect_success 'git-p4 sync new branch' '
+test_expect_success 'git p4 sync new branch' '
test_create_repo "$git" &&
test_when_finished cleanup_git &&
(
cd "$git" &&
test_commit head &&
- "$GITP4" sync --branch=refs/remotes/p4/depot //depot@all &&
+ git p4 sync --branch=refs/remotes/p4/depot //depot@all &&
git log --oneline p4/depot >lines &&
test_line_count = 2 lines
)
@@ -76,7 +76,7 @@ test_expect_success 'clone two dirs' '
p4 add sub2/f2 &&
p4 submit -d "sub2/f2"
) &&
- "$GITP4" clone --dest="$git" //depot/sub1 //depot/sub2 &&
+ git p4 clone --dest="$git" //depot/sub1 //depot/sub2 &&
test_when_finished cleanup_git &&
(
cd "$git" &&
@@ -94,7 +94,7 @@ test_expect_success 'clone two dirs, @all' '
p4 add sub1/f3 &&
p4 submit -d "sub1/f3"
) &&
- "$GITP4" clone --dest="$git" //depot/sub1@all //depot/sub2@all &&
+ git p4 clone --dest="$git" //depot/sub1@all //depot/sub2@all &&
test_when_finished cleanup_git &&
(
cd "$git" &&
@@ -112,7 +112,7 @@ test_expect_success 'clone two dirs, @all, conflicting files' '
p4 add sub2/f3 &&
p4 submit -d "sub2/f3"
) &&
- "$GITP4" clone --dest="$git" //depot/sub1@all //depot/sub2@all &&
+ git p4 clone --dest="$git" //depot/sub1@all //depot/sub2@all &&
test_when_finished cleanup_git &&
(
cd "$git" &&
@@ -134,7 +134,7 @@ test_expect_success 'exit when p4 fails to produce marshaled output' '
exit 1
EOF
chmod 755 "$badp4dir"/p4 &&
- PATH="$badp4dir:$PATH" "$GITP4" clone --dest="$git" //depot >errs 2>&1 ; retval=$? &&
+ PATH="$badp4dir:$PATH" git p4 clone --dest="$git" //depot >errs 2>&1 ; retval=$? &&
test $retval -eq 1 &&
test_must_fail grep -q Traceback errs
'
@@ -151,8 +151,8 @@ test_expect_success 'add p4 files with wildcards in the names' '
)
'
-test_expect_success 'wildcard files git-p4 clone' '
- "$GITP4" clone --dest="$git" //depot &&
+test_expect_success 'wildcard files git p4 clone' '
+ git p4 clone --dest="$git" //depot &&
test_when_finished cleanup_git &&
(
cd "$git" &&
@@ -164,7 +164,7 @@ test_expect_success 'wildcard files git-p4 clone' '
'
test_expect_success 'clone bare' '
- "$GITP4" clone --dest="$git" --bare //depot &&
+ git p4 clone --dest="$git" --bare //depot &&
test_when_finished cleanup_git &&
(
cd "$git" &&
@@ -209,7 +209,7 @@ test_expect_success 'preserve users' '
p4_add_user alice Alice &&
p4_add_user bob Bob &&
p4_grant_admin alice &&
- "$GITP4" clone --dest="$git" //depot &&
+ git p4 clone --dest="$git" //depot &&
test_when_finished cleanup_git &&
(
cd "$git" &&
@@ -218,7 +218,7 @@ test_expect_success 'preserve users' '
git commit --author "Alice <alice@localhost>" -m "a change by alice" file1 &&
git commit --author "Bob <bob@localhost>" -m "a change by bob" file2 &&
git config git-p4.skipSubmitEditCheck true &&
- P4EDITOR=touch P4USER=alice P4PASSWD=secret "$GITP4" commit --preserve-user &&
+ P4EDITOR=touch P4USER=alice P4PASSWD=secret git p4 commit --preserve-user &&
p4_check_commit_author file1 alice &&
p4_check_commit_author file2 bob
)
@@ -227,21 +227,21 @@ test_expect_success 'preserve users' '
# Test username support, submitting as bob, who lacks admin rights. Should
# not submit change to p4 (git diff should show deltas).
test_expect_success 'refuse to preserve users without perms' '
- "$GITP4" clone --dest="$git" //depot &&
+ git p4 clone --dest="$git" //depot &&
test_when_finished cleanup_git &&
(
cd "$git" &&
git config git-p4.skipSubmitEditCheck true &&
echo "username-noperms: a change by alice" >>file1 &&
git commit --author "Alice <alice@localhost>" -m "perms: a change by alice" file1 &&
- P4EDITOR=touch P4USER=bob P4PASSWD=secret test_must_fail "$GITP4" commit --preserve-user &&
+ P4EDITOR=touch P4USER=bob P4PASSWD=secret test_must_fail git p4 commit --preserve-user &&
test_must_fail git diff --exit-code HEAD..p4/master
)
'
# What happens with unknown author? Without allowMissingP4Users it should fail.
test_expect_success 'preserve user where author is unknown to p4' '
- "$GITP4" clone --dest="$git" //depot &&
+ git p4 clone --dest="$git" //depot &&
test_when_finished cleanup_git &&
(
cd "$git" &&
@@ -250,24 +250,24 @@ test_expect_success 'preserve user where author is unknown to p4' '
git commit --author "Bob <bob@localhost>" -m "preserve: a change by bob" file1 &&
echo "username-unknown: a change by charlie" >>file1 &&
git commit --author "Charlie <charlie@localhost>" -m "preserve: a change by charlie" file1 &&
- P4EDITOR=touch P4USER=alice P4PASSWD=secret test_must_fail "$GITP4" commit --preserve-user &&
+ P4EDITOR=touch P4USER=alice P4PASSWD=secret test_must_fail git p4 commit --preserve-user &&
test_must_fail git diff --exit-code HEAD..p4/master &&
echo "$0: repeat with allowMissingP4Users enabled" &&
git config git-p4.allowMissingP4Users true &&
git config git-p4.preserveUser true &&
- P4EDITOR=touch P4USER=alice P4PASSWD=secret "$GITP4" commit &&
+ P4EDITOR=touch P4USER=alice P4PASSWD=secret git p4 commit &&
git diff --exit-code HEAD..p4/master &&
p4_check_commit_author file1 alice
)
'
-# If we're *not* using --preserve-user, git-p4 should warn if we're submitting
+# If we're *not* using --preserve-user, git p4 should warn if we're submitting
# changes that are not all ours.
# Test: user in p4 and user unknown to p4.
# Test: warning disabled and user is the same.
test_expect_success 'not preserving user with mixed authorship' '
- "$GITP4" clone --dest="$git" //depot &&
+ git p4 clone --dest="$git" //depot &&
test_when_finished cleanup_git &&
(
cd "$git" &&
@@ -275,20 +275,20 @@ test_expect_success 'not preserving user with mixed authorship' '
p4_add_user derek Derek &&
make_change_by_user usernamefile3 Derek derek@localhost &&
- P4EDITOR=cat P4USER=alice P4PASSWD=secret "$GITP4" commit |\
+ P4EDITOR=cat P4USER=alice P4PASSWD=secret git p4 commit |\
grep "git author derek@localhost does not match" &&
make_change_by_user usernamefile3 Charlie charlie@localhost &&
- P4EDITOR=cat P4USER=alice P4PASSWD=secret "$GITP4" commit |\
+ P4EDITOR=cat P4USER=alice P4PASSWD=secret git p4 commit |\
grep "git author charlie@localhost does not match" &&
make_change_by_user usernamefile3 alice alice@localhost &&
- P4EDITOR=cat P4USER=alice P4PASSWD=secret "$GITP4" |\
+ P4EDITOR=cat P4USER=alice P4PASSWD=secret git p4 |\
test_must_fail grep "git author.*does not match" &&
git config git-p4.skipUserNameCheck true &&
make_change_by_user usernamefile3 Charlie charlie@localhost &&
- P4EDITOR=cat P4USER=alice P4PASSWD=secret "$GITP4" commit |\
+ P4EDITOR=cat P4USER=alice P4PASSWD=secret git p4 commit |\
test_must_fail grep "git author.*does not match" &&
p4_check_commit_author usernamefile3 alice
@@ -307,7 +307,7 @@ test_expect_success 'initial import time from top change time' '
p4change=$(p4 -G changes -m 1 //depot/... | marshal_dump change) &&
p4time=$(p4 -G changes -m 1 //depot/... | marshal_dump time) &&
sleep 3 &&
- "$GITP4" clone --dest="$git" //depot &&
+ git p4 clone --dest="$git" //depot &&
test_when_finished cleanup_git &&
(
cd "$git" &&
@@ -325,7 +325,7 @@ test_expect_success 'initial import time from top change time' '
# Repeat, this time with a smaller threshold and confirm that the rename is
# detected in P4.
test_expect_success 'detect renames' '
- "$GITP4" clone --dest="$git" //depot@all &&
+ git p4 clone --dest="$git" //depot@all &&
test_when_finished cleanup_git &&
(
cd "$git" &&
@@ -334,7 +334,7 @@ test_expect_success 'detect renames' '
git mv file1 file4 &&
git commit -a -m "Rename file1 to file4" &&
git diff-tree -r -M HEAD &&
- "$GITP4" submit &&
+ git p4 submit &&
p4 filelog //depot/file4 &&
p4 filelog //depot/file4 | test_must_fail grep -q "branch from" &&
@@ -342,7 +342,7 @@ test_expect_success 'detect renames' '
git commit -a -m "Rename file4 to file5" &&
git diff-tree -r -M HEAD &&
git config git-p4.detectRenames true &&
- "$GITP4" submit &&
+ git p4 submit &&
p4 filelog //depot/file5 &&
p4 filelog //depot/file5 | grep -q "branch from //depot/file4" &&
@@ -354,7 +354,7 @@ test_expect_success 'detect renames' '
level=$(git diff-tree -r -M HEAD | sed 1d | cut -f1 | cut -d" " -f5 | sed "s/R0*//") &&
test -n "$level" && test "$level" -gt 0 && test "$level" -lt 98 &&
git config git-p4.detectRenames $(($level + 2)) &&
- "$GITP4" submit &&
+ git p4 submit &&
p4 filelog //depot/file6 &&
p4 filelog //depot/file6 | test_must_fail grep -q "branch from" &&
@@ -366,7 +366,7 @@ test_expect_success 'detect renames' '
level=$(git diff-tree -r -M HEAD | sed 1d | cut -f1 | cut -d" " -f5 | sed "s/R0*//") &&
test -n "$level" && test "$level" -gt 2 && test "$level" -lt 100 &&
git config git-p4.detectRenames $(($level - 2)) &&
- "$GITP4" submit &&
+ git p4 submit &&
p4 filelog //depot/file7 &&
p4 filelog //depot/file7 | grep -q "branch from //depot/file6"
)
@@ -384,7 +384,7 @@ test_expect_success 'detect renames' '
# Modify and copy a file, configure a smaller threshold in detectCopies and
# confirm that copy is detected in P4.
test_expect_success 'detect copies' '
- "$GITP4" clone --dest="$git" //depot@all &&
+ git p4 clone --dest="$git" //depot@all &&
test_when_finished cleanup_git &&
(
cd "$git" &&
@@ -394,7 +394,7 @@ test_expect_success 'detect copies' '
git add file8 &&
git commit -a -m "Copy file2 to file8" &&
git diff-tree -r -C HEAD &&
- "$GITP4" submit &&
+ git p4 submit &&
p4 filelog //depot/file8 &&
p4 filelog //depot/file8 | test_must_fail grep -q "branch from" &&
@@ -403,7 +403,7 @@ test_expect_success 'detect copies' '
git commit -a -m "Copy file2 to file9" &&
git diff-tree -r -C HEAD &&
git config git-p4.detectCopies true &&
- "$GITP4" submit &&
+ git p4 submit &&
p4 filelog //depot/file9 &&
p4 filelog //depot/file9 | test_must_fail grep -q "branch from" &&
@@ -412,7 +412,7 @@ test_expect_success 'detect copies' '
git add file2 file10 &&
git commit -a -m "Modify and copy file2 to file10" &&
git diff-tree -r -C HEAD &&
- "$GITP4" submit &&
+ git p4 submit &&
p4 filelog //depot/file10 &&
p4 filelog //depot/file10 | grep -q "branch from //depot/file" &&
@@ -423,7 +423,7 @@ test_expect_success 'detect copies' '
src=$(git diff-tree -r -C --find-copies-harder HEAD | sed 1d | cut -f2) &&
test "$src" = file10 &&
git config git-p4.detectCopiesHarder true &&
- "$GITP4" submit &&
+ git p4 submit &&
p4 filelog //depot/file11 &&
p4 filelog //depot/file11 | grep -q "branch from //depot/file" &&
@@ -437,7 +437,7 @@ test_expect_success 'detect copies' '
src=$(git diff-tree -r -C --find-copies-harder HEAD | sed 1d | cut -f2) &&
test "$src" = file10 &&
git config git-p4.detectCopies $(($level + 2)) &&
- "$GITP4" submit &&
+ git p4 submit &&
p4 filelog //depot/file12 &&
p4 filelog //depot/file12 | test_must_fail grep -q "branch from" &&
@@ -451,7 +451,7 @@ test_expect_success 'detect copies' '
src=$(git diff-tree -r -C --find-copies-harder HEAD | sed 1d | cut -f2) &&
test "$src" = file10 &&
git config git-p4.detectCopies $(($level - 2)) &&
- "$GITP4" submit &&
+ git p4 submit &&
p4 filelog //depot/file13 &&
p4 filelog //depot/file13 | grep -q "branch from //depot/file"
)
diff --git a/t/t9801-git-p4-branch.sh b/t/t9801-git-p4-branch.sh
index d414705..2859256 100755
--- a/t/t9801-git-p4-branch.sh
+++ b/t/t9801-git-p4-branch.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-test_description='git-p4 p4 branching tests'
+test_description='git p4 tests for p4 branches'
. ./lib-git-p4.sh
@@ -63,7 +63,7 @@ test_expect_success 'basic p4 branches' '
test_expect_success 'import main, no branch detection' '
test_when_finished cleanup_git &&
- "$GITP4" clone --dest="$git" //depot/main@all &&
+ git p4 clone --dest="$git" //depot/main@all &&
(
cd "$git" &&
git log --oneline --graph --decorate --all &&
@@ -74,7 +74,7 @@ test_expect_success 'import main, no branch detection' '
test_expect_success 'import branch1, no branch detection' '
test_when_finished cleanup_git &&
- "$GITP4" clone --dest="$git" //depot/branch1@all &&
+ git p4 clone --dest="$git" //depot/branch1@all &&
(
cd "$git" &&
git log --oneline --graph --decorate --all &&
@@ -85,7 +85,7 @@ test_expect_success 'import branch1, no branch detection' '
test_expect_success 'import branch2, no branch detection' '
test_when_finished cleanup_git &&
- "$GITP4" clone --dest="$git" //depot/branch2@all &&
+ git p4 clone --dest="$git" //depot/branch2@all &&
(
cd "$git" &&
git log --oneline --graph --decorate --all &&
@@ -96,7 +96,7 @@ test_expect_success 'import branch2, no branch detection' '
test_expect_success 'import depot, no branch detection' '
test_when_finished cleanup_git &&
- "$GITP4" clone --dest="$git" //depot@all &&
+ git p4 clone --dest="$git" //depot@all &&
(
cd "$git" &&
git log --oneline --graph --decorate --all &&
@@ -107,7 +107,7 @@ test_expect_success 'import depot, no branch detection' '
test_expect_success 'import depot, branch detection' '
test_when_finished cleanup_git &&
- "$GITP4" clone --dest="$git" --detect-branches //depot@all &&
+ git p4 clone --dest="$git" --detect-branches //depot@all &&
(
cd "$git" &&
@@ -132,7 +132,7 @@ test_expect_success 'import depot, branch detection, branchList branch definitio
(
cd "$git" &&
git config git-p4.branchList main:branch1 &&
- "$GITP4" clone --dest=. --detect-branches //depot@all &&
+ git p4 clone --dest=. --detect-branches //depot@all &&
git log --oneline --graph --decorate --all &&
@@ -189,15 +189,15 @@ test_expect_success 'add simple p4 branches' '
# Configure branches through git-config and clone them.
# All files are tested to make sure branches were cloned correctly.
# Finally, make an update to branch1 on P4 side to check if it is imported
-# correctly by git-p4.
-test_expect_success 'git-p4 clone simple branches' '
+# correctly by git p4.
+test_expect_success 'git p4 clone simple branches' '
test_when_finished cleanup_git &&
test_create_repo "$git" &&
(
cd "$git" &&
git config git-p4.branchList branch1:branch2 &&
git config --add git-p4.branchList branch1:branch3 &&
- "$GITP4" clone --dest=. --detect-branches //depot@all &&
+ git p4 clone --dest=. --detect-branches //depot@all &&
git log --all --graph --decorate --stat &&
git reset --hard p4/depot/branch1 &&
test -f file1 &&
@@ -221,13 +221,13 @@ test_expect_success 'git-p4 clone simple branches' '
p4 submit -d "update file2 in branch3" &&
cd "$git" &&
git reset --hard p4/depot/branch1 &&
- "$GITP4" rebase &&
+ git p4 rebase &&
grep file2_ file2
)
'
# Create a complex branch structure in P4 depot to check if they are correctly
-# cloned. The branches are created from older changelists to check if git-p4 is
+# cloned. The branches are created from older changelists to check if git p4 is
# able to correctly detect them.
# The final expected structure is:
# `branch1
@@ -248,7 +248,7 @@ test_expect_success 'git-p4 clone simple branches' '
# `- file1
# `- file2
# `- file3
-test_expect_success 'git-p4 add complex branches' '
+test_expect_success 'git p4 add complex branches' '
test_when_finished cleanup_git &&
test_create_repo "$git" &&
(
@@ -263,10 +263,10 @@ test_expect_success 'git-p4 add complex branches' '
)
'
-# Configure branches through git-config and clone them. git-p4 will only be able
+# Configure branches through git-config and clone them. git p4 will only be able
# to clone the original structure if it is able to detect the origin changelist
# of each branch.
-test_expect_success 'git-p4 clone complex branches' '
+test_expect_success 'git p4 clone complex branches' '
test_when_finished cleanup_git &&
test_create_repo "$git" &&
(
@@ -275,7 +275,7 @@ test_expect_success 'git-p4 clone complex branches' '
git config --add git-p4.branchList branch1:branch3 &&
git config --add git-p4.branchList branch1:branch4 &&
git config --add git-p4.branchList branch1:branch5 &&
- "$GITP4" clone --dest=. --detect-branches //depot@all &&
+ git p4 clone --dest=. --detect-branches //depot@all &&
git log --all --graph --decorate --stat &&
git reset --hard p4/depot/branch1 &&
test_path_is_file file1 &&
diff --git a/t/t9802-git-p4-filetype.sh b/t/t9802-git-p4-filetype.sh
index 992bb8c..21924df 100755
--- a/t/t9802-git-p4-filetype.sh
+++ b/t/t9802-git-p4-filetype.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-test_description='git-p4 p4 filetype tests'
+test_description='git p4 filetype tests'
. ./lib-git-p4.sh
@@ -37,7 +37,7 @@ test_expect_success 'utf-16 file create' '
test_expect_success 'utf-16 file test' '
test_when_finished cleanup_git &&
- "$GITP4" clone --dest="$git" //depot@all &&
+ git p4 clone --dest="$git" //depot@all &&
(
cd "$git" &&
@@ -84,7 +84,7 @@ test_expect_success 'keyword file test' '
build_smush &&
test_when_finished rm -f k_smush.py ko_smush.py &&
test_when_finished cleanup_git &&
- "$GITP4" clone --dest="$git" //depot@all &&
+ git p4 clone --dest="$git" //depot@all &&
(
cd "$git" &&
@@ -94,7 +94,7 @@ test_expect_success 'keyword file test' '
"$PYTHON_PATH" "$TRASH_DIRECTORY/ko_smush.py" <"$cli/k-text-ko" >cli-k-text-ko-smush &&
test_cmp cli-k-text-ko-smush k-text-ko &&
- # utf16, even though p4 expands keywords, git-p4 does not
+ # utf16, even though p4 expands keywords, git p4 does not
# try to undo that
test_cmp "$cli/k-utf16-k" k-utf16-k &&
test_cmp "$cli/k-utf16-ko" k-utf16-ko
@@ -125,7 +125,7 @@ test_expect_success 'ignore apple' '
p4 submit -d appledouble
) &&
test_when_finished cleanup_git &&
- "$GITP4" clone --dest="$git" //depot@all &&
+ git p4 clone --dest="$git" //depot@all &&
(
cd "$git" &&
test ! -f double.png
diff --git a/t/t9803-git-p4-shell-metachars.sh b/t/t9803-git-p4-shell-metachars.sh
index db67020..fbacff3 100755
--- a/t/t9803-git-p4-shell-metachars.sh
+++ b/t/t9803-git-p4-shell-metachars.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-test_description='git-p4 transparency to shell metachars in filenames'
+test_description='git p4 transparency to shell metachars in filenames'
. ./lib-git-p4.sh
@@ -18,7 +18,7 @@ test_expect_success 'init depot' '
'
test_expect_success 'shell metachars in filenames' '
- "$GITP4" clone --dest="$git" //depot &&
+ git p4 clone --dest="$git" //depot &&
test_when_finished cleanup_git &&
(
cd "$git" &&
@@ -28,7 +28,7 @@ test_expect_success 'shell metachars in filenames' '
echo f2 >"file with spaces" &&
git add "file with spaces" &&
git commit -m "add files" &&
- P4EDITOR=touch "$GITP4" submit
+ P4EDITOR=touch git p4 submit
) &&
(
cd "$cli" &&
@@ -39,7 +39,7 @@ test_expect_success 'shell metachars in filenames' '
'
test_expect_success 'deleting with shell metachars' '
- "$GITP4" clone --dest="$git" //depot &&
+ git p4 clone --dest="$git" //depot &&
test_when_finished cleanup_git &&
(
cd "$git" &&
@@ -47,7 +47,7 @@ test_expect_success 'deleting with shell metachars' '
git rm foo\$bar &&
git rm file\ with\ spaces &&
git commit -m "remove files" &&
- P4EDITOR=touch "$GITP4" submit
+ P4EDITOR=touch git p4 submit
) &&
(
cd "$cli" &&
@@ -97,7 +97,7 @@ test_expect_success 'branch with shell char' '
cd "$git" &&
git config git-p4.branchList main:branch\$3 &&
- "$GITP4" clone --dest=. --detect-branches //depot@all &&
+ git p4 clone --dest=. --detect-branches //depot@all &&
git log --all --graph --decorate --stat &&
git reset --hard p4/depot/branch\$3 &&
test -f shell_char_branch_file &&
diff --git a/t/t9804-git-p4-label.sh b/t/t9804-git-p4-label.sh
index 80d01ea..c8eec0e 100755
--- a/t/t9804-git-p4-label.sh
+++ b/t/t9804-git-p4-label.sh
@@ -1,4 +1,4 @@
-test_description='git-p4 p4 label tests'
+test_description='git p4 label tests'
. ./lib-git-p4.sh
@@ -48,7 +48,7 @@ test_expect_success 'basic p4 labels' '
p4 labels ... &&
- "$GITP4" clone --dest="$git" --detect-labels //depot@all &&
+ git p4 clone --dest="$git" --detect-labels //depot@all &&
cd "$git" &&
git tag &&
@@ -87,7 +87,7 @@ test_expect_failure 'two labels on the same changelist' '
p4 labels ... &&
- "$GITP4" clone --dest="$git" --detect-labels //depot@all &&
+ git p4 clone --dest="$git" --detect-labels //depot@all &&
cd "$git" &&
git tag | grep tag_f1 &&
diff --git a/t/t9805-git-p4-skip-submit-edit.sh b/t/t9805-git-p4-skip-submit-edit.sh
index df929e0..4a72f79 100755
--- a/t/t9805-git-p4-skip-submit-edit.sh
+++ b/t/t9805-git-p4-skip-submit-edit.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-test_description='git-p4 skipSubmitEdit config variables'
+test_description='git p4 skipSubmitEdit config variables'
. ./lib-git-p4.sh
@@ -19,33 +19,33 @@ test_expect_success 'init depot' '
# this works because EDITOR is set to :
test_expect_success 'no config, unedited, say yes' '
- "$GITP4" clone --dest="$git" //depot &&
+ git p4 clone --dest="$git" //depot &&
test_when_finished cleanup_git &&
(
cd "$git" &&
echo line >>file1 &&
git commit -a -m "change 2" &&
- echo y | "$GITP4" submit &&
+ echo y | git p4 submit &&
p4 changes //depot/... >wc &&
test_line_count = 2 wc
)
'
test_expect_success 'no config, unedited, say no' '
- "$GITP4" clone --dest="$git" //depot &&
+ git p4 clone --dest="$git" //depot &&
test_when_finished cleanup_git &&
(
cd "$git" &&
echo line >>file1 &&
git commit -a -m "change 3 (not really)" &&
- printf "bad response\nn\n" | "$GITP4" submit &&
+ printf "bad response\nn\n" | git p4 submit &&
p4 changes //depot/... >wc &&
test_line_count = 2 wc
)
'
test_expect_success 'skipSubmitEdit' '
- "$GITP4" clone --dest="$git" //depot &&
+ git p4 clone --dest="$git" //depot &&
test_when_finished cleanup_git &&
(
cd "$git" &&
@@ -54,21 +54,21 @@ test_expect_success 'skipSubmitEdit' '
git config core.editor /bin/false &&
echo line >>file1 &&
git commit -a -m "change 3" &&
- "$GITP4" submit &&
+ git p4 submit &&
p4 changes //depot/... >wc &&
test_line_count = 3 wc
)
'
test_expect_success 'skipSubmitEditCheck' '
- "$GITP4" clone --dest="$git" //depot &&
+ git p4 clone --dest="$git" //depot &&
test_when_finished cleanup_git &&
(
cd "$git" &&
git config git-p4.skipSubmitEditCheck true &&
echo line >>file1 &&
git commit -a -m "change 4" &&
- "$GITP4" submit &&
+ git p4 submit &&
p4 changes //depot/... >wc &&
test_line_count = 4 wc
)
@@ -76,7 +76,7 @@ test_expect_success 'skipSubmitEditCheck' '
# check the normal case, where the template really is edited
test_expect_success 'no config, edited' '
- "$GITP4" clone --dest="$git" //depot &&
+ git p4 clone --dest="$git" //depot &&
test_when_finished cleanup_git &&
ed="$TRASH_DIRECTORY/ed.sh" &&
test_when_finished "rm \"$ed\"" &&
@@ -91,7 +91,7 @@ test_expect_success 'no config, edited' '
cd "$git" &&
echo line >>file1 &&
git commit -a -m "change 5" &&
- EDITOR="\"$ed\"" "$GITP4" submit &&
+ EDITOR="\"$ed\"" git p4 submit &&
p4 changes //depot/... >wc &&
test_line_count = 5 wc
)
diff --git a/t/t9806-git-p4-options.sh b/t/t9806-git-p4-options.sh
index 0571602..2892367 100755
--- a/t/t9806-git-p4-options.sh
+++ b/t/t9806-git-p4-options.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-test_description='git-p4 options'
+test_description='git p4 options'
. ./lib-git-p4.sh
@@ -24,11 +24,11 @@ test_expect_success 'init depot' '
'
test_expect_success 'clone no --git-dir' '
- test_must_fail "$GITP4" clone --git-dir=xx //depot
+ test_must_fail git p4 clone --git-dir=xx //depot
'
test_expect_success 'clone --branch' '
- "$GITP4" clone --branch=refs/remotes/p4/sb --dest="$git" //depot &&
+ git p4 clone --branch=refs/remotes/p4/sb --dest="$git" //depot &&
test_when_finished cleanup_git &&
(
cd "$git" &&
@@ -42,7 +42,7 @@ test_expect_success 'clone --changesfile' '
cf="$TRASH_DIRECTORY/cf" &&
test_when_finished "rm \"$cf\"" &&
printf "1\n3\n" >"$cf" &&
- "$GITP4" clone --changesfile="$cf" --dest="$git" //depot &&
+ git p4 clone --changesfile="$cf" --dest="$git" //depot &&
test_when_finished cleanup_git &&
(
cd "$git" &&
@@ -58,14 +58,14 @@ test_expect_success 'clone --changesfile, @all' '
cf="$TRASH_DIRECTORY/cf" &&
test_when_finished "rm \"$cf\"" &&
printf "1\n3\n" >"$cf" &&
- test_must_fail "$GITP4" clone --changesfile="$cf" --dest="$git" //depot@all
+ test_must_fail git p4 clone --changesfile="$cf" --dest="$git" //depot@all
'
# imports both master and p4/master in refs/heads
# requires --import-local on sync to find p4 refs/heads
# does not update master on sync, just p4/master
test_expect_success 'clone/sync --import-local' '
- "$GITP4" clone --import-local --dest="$git" //depot@1,2 &&
+ git p4 clone --import-local --dest="$git" //depot@1,2 &&
test_when_finished cleanup_git &&
(
cd "$git" &&
@@ -73,9 +73,9 @@ test_expect_success 'clone/sync --import-local' '
test_line_count = 2 lines &&
git log --oneline refs/heads/p4/master >lines &&
test_line_count = 2 lines &&
- test_must_fail "$GITP4" sync &&
+ test_must_fail git p4 sync &&
- "$GITP4" sync --import-local &&
+ git p4 sync --import-local &&
git log --oneline refs/heads/master >lines &&
test_line_count = 2 lines &&
git log --oneline refs/heads/p4/master >lines &&
@@ -84,7 +84,7 @@ test_expect_success 'clone/sync --import-local' '
'
test_expect_success 'clone --max-changes' '
- "$GITP4" clone --dest="$git" --max-changes 2 //depot@all &&
+ git p4 clone --dest="$git" --max-changes 2 //depot@all &&
test_when_finished cleanup_git &&
(
cd "$git" &&
@@ -101,7 +101,7 @@ test_expect_success 'clone --keep-path' '
p4 add sub/dir/f4 &&
p4 submit -d "change 4"
) &&
- "$GITP4" clone --dest="$git" --keep-path //depot/sub/dir@all &&
+ git p4 clone --dest="$git" --keep-path //depot/sub/dir@all &&
test_when_finished cleanup_git &&
(
cd "$git" &&
@@ -109,7 +109,7 @@ test_expect_success 'clone --keep-path' '
test_path_is_file sub/dir/f4
) &&
cleanup_git &&
- "$GITP4" clone --dest="$git" //depot/sub/dir@all &&
+ git p4 clone --dest="$git" //depot/sub/dir@all &&
(
cd "$git" &&
test_path_is_file f4 &&
@@ -126,7 +126,7 @@ test_expect_success 'clone --use-client-spec' '
(
# big usage message
exec >/dev/null &&
- test_must_fail "$GITP4" clone --dest="$git" --use-client-spec
+ test_must_fail git p4 clone --dest="$git" --use-client-spec
) &&
cli2="$TRASH_DIRECTORY/cli2" &&
mkdir -p "$cli2" &&
@@ -142,7 +142,7 @@ test_expect_success 'clone --use-client-spec' '
) &&
P4CLIENT=client2 &&
test_when_finished cleanup_git &&
- "$GITP4" clone --dest="$git" --use-client-spec //depot/... &&
+ git p4 clone --dest="$git" --use-client-spec //depot/... &&
(
cd "$git" &&
test_path_is_file bus/dir/f4 &&
@@ -156,7 +156,7 @@ test_expect_success 'clone --use-client-spec' '
cd "$git" &&
git init &&
git config git-p4.useClientSpec true &&
- "$GITP4" sync //depot/... &&
+ git p4 sync //depot/... &&
git checkout -b master p4/master &&
test_path_is_file bus/dir/f4 &&
test_path_is_missing file1
diff --git a/t/t9807-git-p4-submit.sh b/t/t9807-git-p4-submit.sh
index b1f61e3..1541716 100755
--- a/t/t9807-git-p4-submit.sh
+++ b/t/t9807-git-p4-submit.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-test_description='git-p4 submit'
+test_description='git p4 submit'
. ./lib-git-p4.sh
@@ -19,7 +19,7 @@ test_expect_success 'init depot' '
test_expect_success 'submit with no client dir' '
test_when_finished cleanup_git &&
- "$GITP4" clone --dest="$git" //depot &&
+ git p4 clone --dest="$git" //depot &&
(
cd "$git" &&
echo file2 >file2 &&
@@ -27,20 +27,20 @@ test_expect_success 'submit with no client dir' '
git commit -m "git commit 2" &&
rm -rf "$cli" &&
git config git-p4.skipSubmitEdit true &&
- "$GITP4" submit
+ git p4 submit
)
'
# make two commits, but tell it to apply only from HEAD^
test_expect_success 'submit --origin' '
test_when_finished cleanup_git &&
- "$GITP4" clone --dest="$git" //depot &&
+ git p4 clone --dest="$git" //depot &&
(
cd "$git" &&
test_commit "file3" &&
test_commit "file4" &&
git config git-p4.skipSubmitEdit true &&
- "$GITP4" submit --origin=HEAD^
+ git p4 submit --origin=HEAD^
) &&
(
cd "$cli" &&
@@ -52,30 +52,30 @@ test_expect_success 'submit --origin' '
test_expect_success 'submit with allowSubmit' '
test_when_finished cleanup_git &&
- "$GITP4" clone --dest="$git" //depot &&
+ git p4 clone --dest="$git" //depot &&
(
cd "$git" &&
test_commit "file5" &&
git config git-p4.skipSubmitEdit true &&
git config git-p4.allowSubmit "nobranch" &&
- test_must_fail "$GITP4" submit &&
+ test_must_fail git p4 submit &&
git config git-p4.allowSubmit "nobranch,master" &&
- "$GITP4" submit
+ git p4 submit
)
'
test_expect_success 'submit with master branch name from argv' '
test_when_finished cleanup_git &&
- "$GITP4" clone --dest="$git" //depot &&
+ git p4 clone --dest="$git" //depot &&
(
cd "$git" &&
test_commit "file6" &&
git config git-p4.skipSubmitEdit true &&
- test_must_fail "$GITP4" submit nobranch &&
+ test_must_fail git p4 submit nobranch &&
git branch otherbranch &&
git reset --hard HEAD^ &&
test_commit "file7" &&
- "$GITP4" submit otherbranch
+ git p4 submit otherbranch
) &&
(
cd "$cli" &&
diff --git a/t/t9808-git-p4-chdir.sh b/t/t9808-git-p4-chdir.sh
index eb8cc95..73c0902 100755
--- a/t/t9808-git-p4-chdir.sh
+++ b/t/t9808-git-p4-chdir.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-test_description='git-p4 relative chdir'
+test_description='git p4 relative chdir'
. ./lib-git-p4.sh
@@ -26,7 +26,7 @@ test_expect_success 'P4CONFIG and absolute dir clone' '
(
P4CONFIG=p4config && export P4CONFIG &&
unset P4PORT P4CLIENT &&
- "$GITP4" clone --verbose --dest="$git" //depot
+ git p4 clone --verbose --dest="$git" //depot
)
'
@@ -38,7 +38,7 @@ test_expect_success 'P4CONFIG and relative dir clone' '
(
P4CONFIG=p4config && export P4CONFIG &&
unset P4PORT P4CLIENT &&
- "$GITP4" clone --verbose --dest="git" //depot
+ git p4 clone --verbose --dest="git" //depot
)
'
diff --git a/t/t9809-git-p4-client-view.sh b/t/t9809-git-p4-client-view.sh
index ae9145e..d86bffd 100755
--- a/t/t9809-git-p4-client-view.sh
+++ b/t/t9809-git-p4-client-view.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-test_description='git-p4 client view'
+test_description='git p4 client view'
. ./lib-git-p4.sh
@@ -92,25 +92,25 @@ test_expect_success 'init depot' '
test_expect_success 'unsupported view wildcard %%n' '
client_view "//depot/%%%%1/sub/... //client/sub/%%%%1/..." &&
test_when_finished cleanup_git &&
- test_must_fail "$GITP4" clone --use-client-spec --dest="$git" //depot
+ test_must_fail git p4 clone --use-client-spec --dest="$git" //depot
'
test_expect_success 'unsupported view wildcard *' '
client_view "//depot/*/bar/... //client/*/bar/..." &&
test_when_finished cleanup_git &&
- test_must_fail "$GITP4" clone --use-client-spec --dest="$git" //depot
+ test_must_fail git p4 clone --use-client-spec --dest="$git" //depot
'
test_expect_success 'wildcard ... only supported at end of spec 1' '
client_view "//depot/.../file11 //client/.../file11" &&
test_when_finished cleanup_git &&
- test_must_fail "$GITP4" clone --use-client-spec --dest="$git" //depot
+ test_must_fail git p4 clone --use-client-spec --dest="$git" //depot
'
test_expect_success 'wildcard ... only supported at end of spec 2' '
client_view "//depot/.../a/... //client/.../a/..." &&
test_when_finished cleanup_git &&
- test_must_fail "$GITP4" clone --use-client-spec --dest="$git" //depot
+ test_must_fail git p4 clone --use-client-spec --dest="$git" //depot
'
test_expect_success 'basic map' '
@@ -118,7 +118,7 @@ test_expect_success 'basic map' '
files="cli1/file11 cli1/file12" &&
client_verify $files &&
test_when_finished cleanup_git &&
- "$GITP4" clone --use-client-spec --dest="$git" //depot &&
+ git p4 clone --use-client-spec --dest="$git" //depot &&
git_verify $files
'
@@ -126,7 +126,7 @@ test_expect_success 'client view with no mappings' '
client_view &&
client_verify &&
test_when_finished cleanup_git &&
- "$GITP4" clone --use-client-spec --dest="$git" //depot &&
+ git p4 clone --use-client-spec --dest="$git" //depot &&
git_verify
'
@@ -135,7 +135,7 @@ test_expect_success 'single file map' '
files="file11" &&
client_verify $files &&
test_when_finished cleanup_git &&
- "$GITP4" clone --use-client-spec --dest="$git" //depot &&
+ git p4 clone --use-client-spec --dest="$git" //depot &&
git_verify $files
'
@@ -146,7 +146,7 @@ test_expect_success 'later mapping takes precedence (entire repo)' '
cli2/dir2/file21 cli2/dir2/file22" &&
client_verify $files &&
test_when_finished cleanup_git &&
- "$GITP4" clone --use-client-spec --dest="$git" //depot &&
+ git p4 clone --use-client-spec --dest="$git" //depot &&
git_verify $files
'
@@ -156,7 +156,7 @@ test_expect_success 'later mapping takes precedence (partial repo)' '
files="file21 file22" &&
client_verify $files &&
test_when_finished cleanup_git &&
- "$GITP4" clone --use-client-spec --dest="$git" //depot &&
+ git p4 clone --use-client-spec --dest="$git" //depot &&
git_verify $files
'
@@ -172,7 +172,7 @@ test_expect_success 'depot path matching rejected client path' '
files="cli12/file21 cli12/file22" &&
client_verify $files &&
test_when_finished cleanup_git &&
- "$GITP4" clone --use-client-spec --dest="$git" //depot &&
+ git p4 clone --use-client-spec --dest="$git" //depot &&
git_verify $files
'
@@ -183,7 +183,7 @@ test_expect_success 'exclusion wildcard, client rhs same (odd)' '
"-//depot/dir2/... //client/..." &&
client_verify &&
test_when_finished cleanup_git &&
- "$GITP4" clone --use-client-spec --dest="$git" //depot &&
+ git p4 clone --use-client-spec --dest="$git" //depot &&
git_verify
'
@@ -193,7 +193,7 @@ test_expect_success 'exclusion wildcard, client rhs different (normal)' '
files="dir1/file11 dir1/file12" &&
client_verify $files &&
test_when_finished cleanup_git &&
- "$GITP4" clone --use-client-spec --dest="$git" //depot &&
+ git p4 clone --use-client-spec --dest="$git" //depot &&
git_verify $files
'
@@ -203,7 +203,7 @@ test_expect_success 'exclusion single file' '
files="dir1/file11 dir1/file12 dir2/file21" &&
client_verify $files &&
test_when_finished cleanup_git &&
- "$GITP4" clone --use-client-spec --dest="$git" //depot &&
+ git p4 clone --use-client-spec --dest="$git" //depot &&
git_verify $files
'
@@ -213,7 +213,7 @@ test_expect_success 'overlay wildcard' '
files="cli/file11 cli/file12 cli/file21 cli/file22" &&
client_verify $files &&
test_when_finished cleanup_git &&
- "$GITP4" clone --use-client-spec --dest="$git" //depot &&
+ git p4 clone --use-client-spec --dest="$git" //depot &&
git_verify $files
'
@@ -223,7 +223,7 @@ test_expect_success 'overlay single file' '
files="cli/file11 cli/file12 cli/file21" &&
client_verify $files &&
test_when_finished cleanup_git &&
- "$GITP4" clone --use-client-spec --dest="$git" //depot &&
+ git p4 clone --use-client-spec --dest="$git" //depot &&
git_verify $files
'
@@ -234,7 +234,7 @@ test_expect_success 'exclusion with later inclusion' '
files="dir1/file11 dir1/file12 dir2incl/file21 dir2incl/file22" &&
client_verify $files &&
test_when_finished cleanup_git &&
- "$GITP4" clone --use-client-spec --dest="$git" //depot &&
+ git p4 clone --use-client-spec --dest="$git" //depot &&
git_verify $files
'
@@ -242,7 +242,7 @@ test_expect_success 'quotes on rhs only' '
client_view "//depot/dir1/... \"//client/cdir 1/...\"" &&
client_verify "cdir 1/file11" "cdir 1/file12" &&
test_when_finished cleanup_git &&
- "$GITP4" clone --use-client-spec --dest="$git" //depot &&
+ git p4 clone --use-client-spec --dest="$git" //depot &&
git_verify "cdir 1/file11" "cdir 1/file12"
'
@@ -282,7 +282,7 @@ test_expect_success 'overlay collision 1 to 2' '
client_verify $files &&
test_cmp actual "$cli"/filecollide &&
test_when_finished cleanup_git &&
- "$GITP4" clone --use-client-spec --dest="$git" //depot &&
+ git p4 clone --use-client-spec --dest="$git" //depot &&
git_verify $files &&
test_cmp actual "$git"/filecollide
'
@@ -295,7 +295,7 @@ test_expect_failure 'overlay collision 2 to 1' '
client_verify $files &&
test_cmp actual "$cli"/filecollide &&
test_when_finished cleanup_git &&
- "$GITP4" clone --use-client-spec --dest="$git" //depot &&
+ git p4 clone --use-client-spec --dest="$git" //depot &&
git_verify $files &&
test_cmp actual "$git"/filecollide
'
@@ -317,7 +317,7 @@ test_expect_failure 'overlay collision 1 to 2, but 2 deleted' '
files="file11 file12 file21 file22" &&
client_verify $files &&
test_when_finished cleanup_git &&
- "$GITP4" clone --use-client-spec --dest="$git" //depot &&
+ git p4 clone --use-client-spec --dest="$git" //depot &&
git_verify $files
'
@@ -340,7 +340,7 @@ test_expect_failure 'overlay collision 1 to 2, but 2 deleted, then 1 updated' '
files="file11 file12 file21 file22" &&
client_verify $files &&
test_when_finished cleanup_git &&
- "$GITP4" clone --use-client-spec --dest="$git" //depot &&
+ git p4 clone --use-client-spec --dest="$git" //depot &&
git_verify $files
'
@@ -396,7 +396,7 @@ test_expect_success 'overlay sync: initial git checkout' '
echo dir1/colA >actual &&
client_verify $files &&
test_cmp actual "$cli"/colA &&
- "$GITP4" clone --use-client-spec --dest="$git" //depot &&
+ git p4 clone --use-client-spec --dest="$git" //depot &&
git_verify $files &&
test_cmp actual "$git"/colA
'
@@ -421,7 +421,7 @@ test_expect_success 'overlay sync: colA content switch' '
test_cmp actual "$cli"/colA &&
(
cd "$git" &&
- "$GITP4" sync --use-client-spec &&
+ git p4 sync --use-client-spec &&
git merge --ff-only p4/master
) &&
git_verify $files &&
@@ -448,7 +448,7 @@ test_expect_success 'overlay sync: colB appears' '
test_cmp actual "$cli"/colB &&
(
cd "$git" &&
- "$GITP4" sync --use-client-spec &&
+ git p4 sync --use-client-spec &&
git merge --ff-only p4/master
) &&
git_verify $files &&
@@ -476,7 +476,7 @@ test_expect_success 'overlay sync: colB disappears' '
test_when_finished cleanup_git &&
(
cd "$git" &&
- "$GITP4" sync --use-client-spec &&
+ git p4 sync --use-client-spec &&
git merge --ff-only p4/master
) &&
git_verify $files
@@ -534,7 +534,7 @@ test_expect_success 'overlay sync swap: initial git checkout' '
echo dir1/colA >actual &&
client_verify $files &&
test_cmp actual "$cli"/colA &&
- "$GITP4" clone --use-client-spec --dest="$git" //depot &&
+ git p4 clone --use-client-spec --dest="$git" //depot &&
git_verify $files &&
test_cmp actual "$git"/colA
'
@@ -559,7 +559,7 @@ test_expect_failure 'overlay sync swap: colA no content switch' '
test_cmp actual "$cli"/colA &&
(
cd "$git" &&
- "$GITP4" sync --use-client-spec &&
+ git p4 sync --use-client-spec &&
git merge --ff-only p4/master
) &&
git_verify $files &&
@@ -586,7 +586,7 @@ test_expect_success 'overlay sync swap: colB appears' '
test_cmp actual "$cli"/colB &&
(
cd "$git" &&
- "$GITP4" sync --use-client-spec &&
+ git p4 sync --use-client-spec &&
git merge --ff-only p4/master
) &&
git_verify $files &&
@@ -616,7 +616,7 @@ test_expect_failure 'overlay sync swap: colB no change' '
test_when_finished cleanup_git &&
(
cd "$git" &&
- "$GITP4" sync --use-client-spec &&
+ git p4 sync --use-client-spec &&
git merge --ff-only p4/master
) &&
git_verify $files &&
@@ -664,7 +664,7 @@ test_expect_success 'quotes on lhs only' '
files="cdir1/file11 cdir1/file12" &&
client_verify $files &&
test_when_finished cleanup_git &&
- "$GITP4" clone --use-client-spec --dest="$git" //depot &&
+ git p4 clone --use-client-spec --dest="$git" //depot &&
client_verify $files
'
@@ -672,7 +672,7 @@ test_expect_success 'quotes on both sides' '
client_view "\"//depot/dir 1/...\" \"//client/cdir 1/...\"" &&
client_verify "cdir 1/file11" "cdir 1/file12" &&
test_when_finished cleanup_git &&
- "$GITP4" clone --use-client-spec --dest="$git" //depot &&
+ git p4 clone --use-client-spec --dest="$git" //depot &&
git_verify "cdir 1/file11" "cdir 1/file12"
'
--
1.7.9.192.ga1d4b
^ permalink raw reply related
* Re: [RFC PATCH 0/3] git-p4: move to toplevel
From: Luke Diamand @ 2012-02-12 18:54 UTC (permalink / raw)
To: Pete Wyckoff; +Cc: git, Vitor Antunes
In-Reply-To: <1329070423-23761-1-git-send-email-pw@padd.com>
On 12/02/12 18:13, Pete Wyckoff wrote:
> The git-p4 code is in a single python script down in
> contrib/fast-import now. I'd like to move it up to the top-level
> source directory of git to make it easier to build and
> distribute. Git-p4 already takes advantage of the git
> infrastructure for documentation and testing, as well as the
> community support (Junio, many reviewers).
About time this was done. There's still a few oddities around but far
fewer than there used to be. I don't know if Junio has some rules on
what a command needs before it graduates from contrib though.
<snip>
> a core git package, or as a separate add-on. Getting support
> for python and git-p4 in msysgit is something I'd like to see
> happen too.
Not sure about msysgit, but last time I tried on Windows it didn't work
at all well.
>
> While I considered taking this opportunity to split up git-p4
> into more modular components across multiple files, it seems best
> now just to do the script move intact. That effort could come
> later. If anyone has a strong preference to do this now, we could.
Regards!
Luke
^ permalink raw reply
* Re: [PATCH/RFC] Auto detection in Makefile if msgfmt is not available
From: Torsten Bögershausen @ 2012-02-12 19:09 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Ævar Arnfjörð Bjarmason, git
In-Reply-To: <7vr4y0j79w.fsf@alter.siamese.dyndns.org>
Am 12.02.2012 um 18:22 schrieb Junio C Hamano:
> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
>
>> 2012/2/12 Torsten Bögershausen <tboegi@web.de>:
>>> Added a simple auto-detection and switch to NO_GETTEXT when
>>> msgfmt could not be found on the system
>>
>> Oh look, a start at our very own autoconf replacement :)
>
> It is a bad idea for the Makefile to silently decide to flip NO_GETTEXT
> when the system happens to be missing msgfmt without letting the user know
> what is happening. Current behaviour to error out will at least give an
> opportunity to stop and think if installing gettext suite on the system
> makes sense before proceeding.
>
> Given that the Makefile only has this to say:
>
> # Define NO_GETTEXT if you don't want Git output to be translated.
> # A translated Git requires GNU libintl or another gettext implementation,
> # plus libintl-perl at runtime.
>
> expecting that "msgfmt: no such command" clicks "Ah, I do not have gettext
> suite" for anybody who attempts to build (and fail) Git, it however is
> also a bit unfair and unhelpful.
>
> Perhaps something like this is necessary and sufficient.
>
> # Define NO_GETTEXT if you don't want Git output to be translated or if
> # you do not have gettext suite (e.g. "msgfmt" and "gettext" commands).
> # A translated Git requires GNU libintl or another gettext implementation,
> # plus libintl-perl at runtime.
Thanks all!
a) the problem was fixed by "sudo apt-get install gettext", which leads to
b) The comment was very helpful ( As I didn't know which package to install) and the final question:
c) Should I send a new patch ?
/Torsten
^ permalink raw reply
* Re: [RFC/PATCHv2 2/2] git-p4: initial demonstration of possible RCS keyword fixup
From: Luke Diamand @ 2012-02-12 20:07 UTC (permalink / raw)
To: Pete Wyckoff; +Cc: git, Eric Scouten
In-Reply-To: <20120211234248.GA16691@padd.com>
On 11/02/12 23:42, Pete Wyckoff wrote:
>
> I'll send along a bunch of test cases I wrote to play around
> with this. Your case had too many moving parts for me to
> understand. If there's something in there that isn't covered,
> maybe you can factor it out into something small? Feel free
> to merge any of my code in with a future resubmission.
Thanks - I'm glad you like it! I'll rework it with your code and resubmit.
>
> Some comments in this code below:
>
>
> This is a novel approach too. Instead of just guessing that
> keywords are causing the conflict, inspect the diff for context
> or edited lines containing keywords.
>
> Or we could just always scrub every file before even trying to
> apply patches.
I guess scrubbing every file could get quite slow. We have people
checking in hundreds of megabytes of C test vectors....
>
> In a few spots I see you've taken the ":" out of the regex. This
> will match strings like $Idiot$ that shouldn't be keyword
> expanded.
Good point - I'll put the ':' back.
>
> Impressed.
Thanks!
Updated patch series to follow.
Luke
^ permalink raw reply
* Re: Git documentation at kernel.org
From: Matthieu Moy @ 2012-02-12 22:04 UTC (permalink / raw)
To: Jeff King; +Cc: Junio C Hamano, Clemens Buchacher, ftpadmin, Petr Onderka, git
In-Reply-To: <20120210200401.GB5504@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
> If there is interest in this, we would be happy to host the
> documentation. Let me know if that is the case, and we can give it a
> much better URL than schacon.github.com. However, I tend to think that
> since the project is hosted[1] at kernel.org, the official documentation
> site should be there as well.
kernel.org is probably the most "official" place for developers, but for
Git users, http://git-scm.com/ is most likely the best entry point. If
it were not for historical reasons, I think http://git-scm.com/docs/ or
so would be the most natural URL to host official docs.
--
Matthieu Moy
http://www-verimag.imag.fr/~moy/
^ permalink raw reply
* Re: Git documentation at kernel.org
From: Jeff King @ 2012-02-12 22:25 UTC (permalink / raw)
To: Matthieu Moy
Cc: Junio C Hamano, Clemens Buchacher, ftpadmin, Petr Onderka, git
In-Reply-To: <vpqehtz909k.fsf@bauges.imag.fr>
On Sun, Feb 12, 2012 at 11:04:23PM +0100, Matthieu Moy wrote:
> Jeff King <peff@peff.net> writes:
>
> > If there is interest in this, we would be happy to host the
> > documentation. Let me know if that is the case, and we can give it a
> > much better URL than schacon.github.com. However, I tend to think that
> > since the project is hosted[1] at kernel.org, the official documentation
> > site should be there as well.
>
> kernel.org is probably the most "official" place for developers, but for
> Git users, http://git-scm.com/ is most likely the best entry point. If
> it were not for historical reasons, I think http://git-scm.com/docs/ or
> so would be the most natural URL to host official docs.
Good point. That is probably the best place to host it.
As far as historical reasons, perhaps the right answer is to put the
documentation where it makes sense to go _now_, and ask kernel.org to
issue http redirects for http://kernel.org/pub/software/scm/git/docs.
-Peff
^ permalink raw reply
* Re: Git documentation at kernel.org
From: Scott Chacon @ 2012-02-12 23:04 UTC (permalink / raw)
To: Jeff King
Cc: Matthieu Moy, Junio C Hamano, Clemens Buchacher, ftpadmin,
Petr Onderka, git
In-Reply-To: <20120212222508.GA25619@sigill.intra.peff.net>
Hey,
On Sun, Feb 12, 2012 at 2:25 PM, Jeff King <peff@peff.net> wrote:
>> kernel.org is probably the most "official" place for developers, but for
>> Git users, http://git-scm.com/ is most likely the best entry point. If
>> it were not for historical reasons, I think http://git-scm.com/docs/ or
>> so would be the most natural URL to host official docs.
>
> Good point. That is probably the best place to host it.
>
> As far as historical reasons, perhaps the right answer is to put the
> documentation where it makes sense to go _now_, and ask kernel.org to
> issue http redirects for http://kernel.org/pub/software/scm/git/docs.
I would be happy to set this up. I'm currently in the process of
revamping the website and this is one of the things I'm planning on
doing anyways - not just hosting the generated docs, but also making
them searchable and whatnot.
Actually, as long as I'm on this, what do people think about git-scm
hosting the wiki as well? As far as I can tell, it was down for
months and now it's back in some sort of weird read-only state. If I
imported everything into a different wiki and hosted it on git-scm
would that be acceptable?
Also, something that I realized I am not willing to maintain any more
is the Git Community Book. It was an experiment at reorganizing some
of the docs, but instead I spent my time on Pro Git, which is CC
licensed. Would anyone object to me removing the community book from
the git-scm site and more tightly integrating the Pro Git content?
It's more up to date and better content, I feel - I would rather have
one book to maintain than two. However, since it is a commercial
product (albeit a Creative Commons licensed one), I wasn't sure if
people would have an issue with it.
Scott
^ permalink raw reply
* Re: [PATCH 1/2] git-svn.perl: perform deletions before anything else
From: Eric Wong @ 2012-02-12 23:49 UTC (permalink / raw)
To: Steven Walter; +Cc: gitster, git
In-Reply-To: <CAK8d-aKJCBq2xpsz65hA4g8oa_szKaofLpkYB3v3_2dd=BAgiQ@mail.gmail.com>
Steven Walter <stevenrwalter@gmail.com> wrote:
> On Sun, Feb 12, 2012 at 2:03 AM, Eric Wong <normalperson@yhbt.net> wrote:
> > Steven Walter <stevenrwalter@gmail.com> wrote:
> >> Signed-off-by: Steven Walter <stevenrwalter@gmail.com>
> >
> > Thanks, shall I fixup 2/2 and assume you meant to Sign-off on that, too?
>
> Yes, thanks
Ugh, I got a bunch of test failures on t9100-git-svn-basic.sh with your
updated 1/2 and a trivially merged 2/2:
not ok - 7 detect node change from file to directory #2
not ok - 12 new symlink is added to a file that was also just made executable
not ok - 13 modify a symlink to become a file
not ok - 14 commit with UTF-8 message: locale: en_US.UTF-8
not ok - 16 check imported tree checksums expected tree checksums
1/2 alone seems to pass all existing tests.
I would very much appreciate new test cases that can show exactly what's
fixed by your patches (esp given the only times I run/use git-svn is
when reviewing patches). Thanks!.
^ permalink raw reply
* Re: Git documentation at kernel.org
From: Jeff King @ 2012-02-13 0:30 UTC (permalink / raw)
To: Scott Chacon
Cc: Matthieu Moy, Junio C Hamano, Clemens Buchacher, ftpadmin,
Petr Onderka, git
In-Reply-To: <CAP2yMa+2E6101fe3Z2WTCfuGnq17WT7nDUQr7PVH6_YKRnNifw@mail.gmail.com>
On Sun, Feb 12, 2012 at 03:04:59PM -0800, Scott Chacon wrote:
> > Good point. That is probably the best place to host it.
> >
> > As far as historical reasons, perhaps the right answer is to put the
> > documentation where it makes sense to go _now_, and ask kernel.org to
> > issue http redirects for http://kernel.org/pub/software/scm/git/docs.
>
> I would be happy to set this up. I'm currently in the process of
> revamping the website and this is one of the things I'm planning on
> doing anyways - not just hosting the generated docs, but also making
> them searchable and whatnot.
That sounds great to me. I'd like to be link-compatible with the old
kernel.org docs section (even if through redirects) so that old links
work (assuming kernel.org gives us a wholesale redirect). Which means
importing all of the docs for released versions. I don't know if the old
kernel.org doc tree was saved anywhere, but if I understand correctly,
they are identical to what's in the "git-htmldocs" repository (which I
_thought_ Junio wasn't going to keep updating, but it seems pretty up to
date).
> Actually, as long as I'm on this, what do people think about git-scm
> hosting the wiki as well? As far as I can tell, it was down for
> months and now it's back in some sort of weird read-only state. If I
> imported everything into a different wiki and hosted it on git-scm
> would that be acceptable?
I'd really love it if the wiki was converted to something that was
git-backed. But I suspect some people might complain about switching off
of mediawiki. IIRC, gollum supports some mediawiki syntax, but I don't
know how much conversion work there would be.
> Also, something that I realized I am not willing to maintain any more
> is the Git Community Book. It was an experiment at reorganizing some
> of the docs, but instead I spent my time on Pro Git, which is CC
> licensed. Would anyone object to me removing the community book from
> the git-scm site and more tightly integrating the Pro Git content?
> It's more up to date and better content, I feel - I would rather have
> one book to maintain than two. However, since it is a commercial
> product (albeit a Creative Commons licensed one), I wasn't sure if
> people would have an issue with it.
I can't remember anybody mentioning the Git Community Book here in the
past few years. New users typically come with a "I read this in Pro Git
and I don't understand..." question, and experienced users recommend or
link to Pro Git. So I think the world would be a less confusing place
with just the one source.
-Peff
^ permalink raw reply
* Re: Bulgarian translation of git
From: Jiang Xin @ 2012-02-13 2:46 UTC (permalink / raw)
To: Alexander Shopov (Александър Шопов)
Cc: Git List, Junio C Hamano, Ævar Arnfjörð Bjarmason
In-Reply-To: <75009f1d7c4aba4d62bb226ab122932c@192.168.122.10>
Junio has a suggestion on how to contrib l10n for git, and you can see the
discussion here: http://article.gmane.org/gmane.comp.version-control.git/189584.
Seems that the suggested git-po repo has not been setup yet, so let me
have a try.
1. Repositiry git-po is hosted on GitHub: https://github.com/gotgit/git-po/
2. I made a commit on the maint branch with a initial version of 'po/git.pot'
https://github.com/gotgit/git-po/commit/4247a7a9d39e2a74ce1d58e5eb1f5e5d87977989
3. As l10n coordinator for Chinese, I translate against the pot file, and
the translated po file 'po/zh_CN.po' is commited in my own branch:
maint-zh-cn.
You can find the commit in:
https://github.com/gotgit/git-po/commits/maint-zh-cn
4. I will merge the commit in branch maint-zh-cn back or other l10n
coordinators' contributes
to maint branch.
I have a question, which version of po should be maintained? master
branch or maint branch.
2012/2/10 "Alexander Shopov (Александър Шопов)" <lists@kambanaria.org>:
> Hello,
>
> I am Alexander Shopov and would like to volunteer for the Bulgarian
> translation of git po file if no one else is doing this.
> How should I contribute it back?
> Via this email list, via fork-push from github, or a patch?
>
> Kind regards:
> al_shopov
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
蒋鑫
北京群英汇信息技术有限公司
邮件: worldhello.net@gmail.com
网址: http://www.ossxp.com/
博客: http://www.worldhello.net/
微博: http://weibo.com/gotgit/
电话: 010-51262007, 18601196889
^ permalink raw reply
* Re: Git documentation at kernel.org
From: Junio C Hamano @ 2012-02-13 3:23 UTC (permalink / raw)
To: Jeff King
Cc: Scott Chacon, Matthieu Moy, Clemens Buchacher, ftpadmin,
Petr Onderka, git
In-Reply-To: <20120213003024.GA25794@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
> That sounds great to me. I'd like to be link-compatible with the old
> kernel.org docs section (even if through redirects) so that old links
> work (assuming kernel.org gives us a wholesale redirect). Which means
> importing all of the docs for released versions. I don't know if the old
> kernel.org doc tree was saved anywhere, but if I understand correctly,
> they are identical to what's in the "git-htmldocs" repository (which I
> _thought_ Junio wasn't going to keep updating, but it seems pretty up to
> date).
I have been updating htmldocs/manpages repositories on "unless I forget"
basis every time the public 'master' gets updated, so they are updated as
frequently as they used to back when they were autogenerated, "unless I
forget".
But the contents of htmldocs does _not_ match what used to be at k.org in
that its git.html does not have links to documentation pages for older
releases, iow, formatted without "stalenotes" defined.
This is because formatting with "stalenotes" needs to make an assumption
on the filesystem layout that I cannot enforce to the users of htmldocs
repository. They will get one tarball for one version, and it is up to
them where they extract these tarballs. They need to extract the tarball
of an older release vX.Y.Z in vX.Y.Z subdirectory next to the git.html of
the latest living document to match the layout, but otherwise the links
created by "stalenotes" will become dangling.
^ permalink raw reply
* Re: [PATCH] strbuf: move strbuf_readline_fd() from bundle.c to strbuf.{c,h}
From: 徐迪 @ 2012-02-13 3:54 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Git 邮件列表
In-Reply-To: <7v39agkmjf.fsf@alter.siamese.dyndns.org>
>> Shouldn't I supposed to receive any information about this patch?
>
> Not necessarily X-<.
>
> Things can get lost in the noise, and sending a reminder message like you
> just did, after waiting for a few to several days, is considered a good
> practice.
>
Ok, excuse me, but this is my first time to make a patch. I'm
desperately want to know its fate :)
>> Has it accepted or not?
>
> Anything and everything being considered for inclusion is reachable from
> the tip of the 'next' branch; other patches that might turn out to be of
> value, or ones that at least deserve more sets of eyeballs, are only in
> the 'pu' branch.
>
Does this mean that we can check 'next' branch to see if any of our
patches being considered for inclusion?
^ permalink raw reply
* Re: Bulgarian translation of git
From: Junio C Hamano @ 2012-02-13 3:56 UTC (permalink / raw)
To: Jiang Xin
Cc: Git List, Ævar Arnfjörð Bjarmason,
Alexander Shopov (Александър Шопов)
In-Reply-To: <CANYiYbGr3zN-kJwq_MCnttNZP6Cc0aj-fsZjd4V=4z+BA5TvUw@mail.gmail.com>
Jiang Xin <worldhello.net@gmail.com> writes:
> Junio has a suggestion on how to contrib l10n for git, and you can see the
> discussion here: http://article.gmane.org/gmane.comp.version-control.git/189584.
>
> Seems that the suggested git-po repo has not been setup yet, so let me
> have a try.
>
> 1. Repositiry git-po is hosted on GitHub: https://github.com/gotgit/git-po/
>
> 2. I made a commit on the maint branch with a initial version of 'po/git.pot'
> https://github.com/gotgit/git-po/commit/4247a7a9d39e2a74ce1d58e5eb1f5e5d87977989
Somebody needs to eyeball this commit before anything else happens on top
of it, so that if there is a glaring mistake it can be caught before it
spreads to affect work by translators for various languages.
> 3. As l10n coordinator for Chinese, I translate against the pot file, and
> the translated po file 'po/zh_CN.po' is commited in my own branch:
> maint-zh-cn.
> You can find the commit in:
> https://github.com/gotgit/git-po/commits/maint-zh-cn
>
> 4. I will merge the commit in branch maint-zh-cn back or other l10n
> coordinators' contributes
> to maint branch.
>
> I have a question, which version of po should be maintained? master
> branch or maint branch.
I would say for this round the git-po repository and its pot file should
pick up whatever new translatable strings are added to 'master'.
After this is merged in 1.7.10, we may want to maintain separate tracks,
but at this moment there is no point maintaining something mergeable to
1.7.9.x maintenance track.
^ permalink raw reply
* Re: [PATCH 1/7] t5700: document a failure of alternates to affect fetch
From: Junio C Hamano @ 2012-02-13 3:35 UTC (permalink / raw)
To: mhagger; +Cc: git, Jeff King, Jakub Narebski, Heiko Voigt, Johan Herland
In-Reply-To: <1328941261-29746-2-git-send-email-mhagger@alum.mit.edu>
mhagger@alum.mit.edu writes:
> +test_expect_success 'prepare branched repository' '
> + git clone A J &&
> + (
> + cd J &&
> + git checkout -b other master^ &&
> + echo other > otherfile &&
s/ > / >/; but that is nothing I cannot fix locally.
> +test_expect_failure 'fetch with incomplete alternates' '
I am assuming that this "incomplete" means "this alternate helps reducing
the number of objects we need to fetch from the remote, but it does not
have everything objects we need, and we still need to fetch some from the
remote". Am I correct?
I do not think you meant the alternate repository is in some way corrupt,
but I am just making sure, because I found the phrasing a bit odd.
^ permalink raw reply
* Re: [PATCH 2/7] clone.c: move more code into the "if (refs)" conditional
From: Junio C Hamano @ 2012-02-13 3:35 UTC (permalink / raw)
To: mhagger; +Cc: git, Jeff King, Jakub Narebski, Heiko Voigt, Johan Herland
In-Reply-To: <1328941261-29746-3-git-send-email-mhagger@alum.mit.edu>
mhagger@alum.mit.edu writes:
> From: Michael Haggerty <mhagger@alum.mit.edu>
>
> The bahavior of a bunch of code before the "if (refs)" statement also
> depends on whether refs is set, so make the logic clearer by shifting
> this code into the if statement.
>
> Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
> ---
> builtin/clone.c | 39 ++++++++++++++++++++-------------------
> 1 files changed, 20 insertions(+), 19 deletions(-)
Nice; the result is much easier to follow.
^ permalink raw reply
* Re: [PATCH 3/7] fetch-pack.c: rename some parameters from "path" to "refname"
From: Junio C Hamano @ 2012-02-13 3:47 UTC (permalink / raw)
To: mhagger; +Cc: git, Jeff King, Jakub Narebski, Heiko Voigt, Johan Herland
In-Reply-To: <1328941261-29746-4-git-send-email-mhagger@alum.mit.edu>
mhagger@alum.mit.edu writes:
> From: Michael Haggerty <mhagger@alum.mit.edu>
>
> The parameters denote reference names, which are no longer 1:1 with
> filesystem paths.
These three functions are only used as callback from for_each_ref() so
they always get the full refname and nothing else (like a partial refname
like tags/v1.7.9), so calling them refname makes perfect sense.
Even though I generally try to stay away from this kind of naming churn
patches, but hopefully there is nothing in flight to cause horrible
conflict with it.
Thanks.
^ permalink raw reply
* Re: [PATCH 6/7] clone: do not add alternate references to extra_refs
From: Junio C Hamano @ 2012-02-13 4:00 UTC (permalink / raw)
To: mhagger; +Cc: git, Jeff King, Jakub Narebski, Heiko Voigt, Johan Herland
In-Reply-To: <1328941261-29746-7-git-send-email-mhagger@alum.mit.edu>
mhagger@alum.mit.edu writes:
> From: Michael Haggerty <mhagger@alum.mit.edu>
>
> Alternate references are directly (and now, correctly) handled by
> fetch-pack, so there is no need to inform fetch-pack about them via
> the extra_refs back channel.
>
> Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
> ---
> builtin/clone.c | 12 ------------
> 1 files changed, 0 insertions(+), 12 deletions(-)
Very nice (the real niceness primarily comes from the previous step ;-).
Thanks.
^ permalink raw reply
* Re: [PATCH 1/7] t5700: document a failure of alternates to affect fetch
From: Michael Haggerty @ 2012-02-13 4:45 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Jeff King, Jakub Narebski, Heiko Voigt, Johan Herland
In-Reply-To: <7vsjifids5.fsf@alter.siamese.dyndns.org>
On 02/13/2012 04:35 AM, Junio C Hamano wrote:
> mhagger@alum.mit.edu writes:
>
>> +test_expect_success 'prepare branched repository' '
>> + git clone A J &&
>> + (
>> + cd J &&
>> + git checkout -b other master^ &&
>> + echo other > otherfile &&
>
> s/ > / >/; but that is nothing I cannot fix locally.
>
>> +test_expect_failure 'fetch with incomplete alternates' '
>
> I am assuming that this "incomplete" means "this alternate helps reducing
> the number of objects we need to fetch from the remote, but it does not
> have everything objects we need, and we still need to fetch some from the
> remote". Am I correct?
Correct. Feel free to improve the description if you can think of a
better way to describe it.
Michael
--
Michael Haggerty
mhagger@alum.mit.edu
http://softwareswirl.blogspot.com/
^ permalink raw reply
* Re: [PATCHv2 1/4] refs: add common refname_match_patterns()
From: Michael Haggerty @ 2012-02-13 5:00 UTC (permalink / raw)
To: Tom Grennan; +Cc: pclouds, git, gitster, jasampler
In-Reply-To: <20120211191748.GC4903@tgrennan-laptop>
On 02/11/2012 08:17 PM, Tom Grennan wrote:
> Yes, I didn't explicitly state that the precedence is the order written
> and in correctly described the first case. How about?
>
> /**
> * Returns in highest to lowest precedence:
> * 1 with an empty patterns list
> * 0 if refname fnmatch()es any ^ prefaced pattern
> * 1 if refname fnmatch()es any other pattern
> * 0 otherwise
> */
Much better; thanks.
Please note that this choice of semantics limits its power. For
example, if the rule were instead (like with gitattributes(5)) "if more
than one pattern matches a refname, a later pattern overrides an earlier
pattern", then one could do things like
refs/remotes/*/* !refs/remotes/gitster/* refs/remotes/gitster/master
to include specific references within a hierarchy that is otherwise
excluded.
However, since rev-list apparently uses a rule more like the one that
you are proposing, it might be better to be consistent than to choose a
different convention.
Michael
--
Michael Haggerty
mhagger@alum.mit.edu
http://softwareswirl.blogspot.com/
^ permalink raw reply
* Re: [RFC/PATCH] tag: make list exclude !<pattern>
From: Michael Haggerty @ 2012-02-13 5:29 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Tom Grennan, pclouds, git, krh, jasampler
In-Reply-To: <7vlio9n5ym.fsf@alter.siamese.dyndns.org>
On 02/11/2012 09:13 AM, Junio C Hamano wrote:
> Michael Haggerty <mhagger@alum.mit.edu> writes:
>
>> The proposal, amended to use "^" instead of "!", is that
>>
>> git for-each-ref A B ^C
>>
>> should mean "the reference names A and B but not C". Therefore, the command
>>
>> git rev-list $(git for-each-ref A B ^C)
>>
>> , which consistency suggests should do the same thing as the first
>> command,...
>
> That is an utter rubbish that does not even deserve a response.
>
> Your argument is like saying
>
> git for-each-ref A
>
> and
>
> git for-each-ref $(git rev-parse A)
>
> should somehow magically produce the same (or related) result. The
> for-each-ref command operates on refname patterns, while rev-list and
> rev-parse takes object names.
Of *course* they operate on different namespaces. But part of the way
that revisions are selected using rev-list is by *selecting or excluding
refnames* from which it should crawl. How long do you think it will be
before somebody asks for rev-list to be able to crawl from a set of
branches *except for those that match some pattern*? (Hint: I more or
less asked for this feature in the "rubbish" email that you quoted.) At
that point we will have to say one of the following:
"Your suggestion is utter rubbish; just type 'git rev-list $(git
for-each-ref A B ^C)'."
This is an acceptable (though somewhat verbose) answer for the Unix
command line; for msgit users it is useless, and it probably cannot be
used in non-command-line scenarios like the gitk "edit view" dialog.
"Sure, but we have to invent yet another syntax because the one used by
for-each-ref conflicts with the existing syntax of rev-list." This
would be the standard git project practice of letting the UI accrete
into an ever more incomprehensible mess.
That is why I suggest that we choose a new syntax *now* for for-each-ref
(and "branch --list", "tag --list", etc) so that the same syntax can be
used later in rev-list, rev-parse, etc.
Michael
--
Michael Haggerty
mhagger@alum.mit.edu
http://softwareswirl.blogspot.com/
^ permalink raw reply
* Re: [RFC PATCH 0/3] git-p4: move to toplevel
From: Junio C Hamano @ 2012-02-13 6:17 UTC (permalink / raw)
To: Luke Diamand; +Cc: Pete Wyckoff, git, Vitor Antunes
In-Reply-To: <4F380ADB.4090304@diamand.org>
Luke Diamand <luke@diamand.org> writes:
> On 12/02/12 18:13, Pete Wyckoff wrote:
>> The git-p4 code is in a single python script down in
>> contrib/fast-import now. I'd like to move it up to the top-level
>> source directory of git to make it easier to build and
>> distribute. Git-p4 already takes advantage of the git
>> infrastructure for documentation and testing, as well as the
>> community support (Junio, many reviewers).
>
> About time this was done. There's still a few oddities around but far
> fewer than there used to be. I don't know if Junio has some rules on
> what a command needs before it graduates from contrib though.
I try not to play a dictator around here. The primary thing I hesitated so
far about git-p4 is that it is useless if you live in the open source only
world, iow without proprietary software.
^ permalink raw reply
* Re: [RFC/PATCH] tag: make list exclude !<pattern>
From: Junio C Hamano @ 2012-02-13 6:37 UTC (permalink / raw)
To: Michael Haggerty; +Cc: Tom Grennan, pclouds, git, krh, jasampler
In-Reply-To: <4F389FB1.2070706@alum.mit.edu>
Michael Haggerty <mhagger@alum.mit.edu> writes:
> Of *course* they operate on different namespaces. But part of the way
> that revisions are selected using rev-list is by *selecting or excluding
> refnames* from which it should crawl.
I am appalled if that is truly the understanding of yours, after having
taken more than a few patches from you to fairly core parts of Git.
"rev-list A ^B" does not say "include A and exclude B from which rev-list
should crawl" AT ALL. We _actively_ crawl from both A and B. It is that
what are reachable from B is painted in a color different from the color
in which we paint what are reachable from A.
A better pair you could have mentioned would be for-each-ref vs rev-parse
(not rev-list). What Tom wanted with "do not show the refs that match the
pattern" he originally wanted to give to "tag --list" would be
for-each-ref A ^B
that is "show ref that matches A but do not show if it also matches B",
while what you want to say is "I want to paint A in positive color and
paint B in negative color, and I want to get a canonical notation to do
so", it is spelled with rev-parse, not for-each-ref, like this:
rev-parse A ^B
In other words,
git rev-list $(git rev-parse A ^B)
would be the equivalent to "git rev-list A ^B".
Maybe you are troubled that there are multiple concepts of negation, which
ultimately comes from the undeniable fact that for-each-ref and rev-parse
operate on entities in different concept domain (refnames and objects)?
And if we decide to use "^", then these two different concepts of negation
are both expressed with the same operator "prefix ^", leading to
confusion?
I am kind of sympathetic to that argument, and it might be a better idea
to avoid using "^" as the negation for matching operator, in order to make
it more apparent to the users that for-each-ref and rev-parse operate on
different concepts. But at the same time, if you know these are distinct
concepts, using the same "^" operator as a consistent way to express the
"negation" that is applicable in each concept domain does make it easier
for users as they gain experience. I tend to avoid making things too hard
for experienced users for the sake of flattening the very early learning
curve when possible, because nobody will stay novice forever.
^ permalink raw reply
* Re: [PATCH 6/8] gitweb: Highlight interesting parts of diff
From: Michal Kiedrowicz @ 2012-02-13 6:41 UTC (permalink / raw)
To: Jakub Narebski; +Cc: git
In-Reply-To: <m3y5s9rl3g.fsf@localhost.localdomain>
Jakub Narebski <jnareb@gmail.com> wrote:
> Michał Kiedrowicz <michal.kiedrowicz@gmail.com> writes:
>
> > Reading diff output is sometimes very hard, even if it's colored,
> > especially if lines differ only in few characters. This is often
> > true when a commit fixes a typo or renames some variables or
> > functions.
> >
> This is certainly nice feature to have. I think most tools that
> implement side-by-side diff implement this too.
>
> > This commit teaches gitweb to highlight characters that are
> > different between old and new line. This should work in the
> > similar manner as in Trac or GitHub.
> >
> Doe you have URLs with good examples of such diff refinement
> highlighting (GNU Emacs ediff/emerge terminology) / highlighting
> differing segments (diff-highlight terminology)?
I haven't found *examples* on GitHub and Trac sites, but what about
these ones:
https://github.com/gitster/git/commit/8cad4744ee37ebec1d9491a1381ec1771a1ba795
http://trac.edgewall.org/changeset/10973
>
> > The code that compares lines is based on
> > contrib/diff-highlight/diff-highlight, except that it works with
> > multiline changes too. It also won't highlight lines that are
> > completely different because that would only make the output
> > unreadable.
> >
> So what does it look like? From the contrib/diff-highlight/README I
> guess that it finds common prefix and common suffix, and highlights
> the rest, which includes change.
Yes.
> It doesn't implement LCS / diff
> algorithm like e.g. tkdiff does for its diff refinement highlighting,
> isn't it?
>
I doesn't. I share the Jeff's opinion that:
a) Jeff's approach is "good enough"
b) LCS on bytes could be very confusing if it marked few sets of
characters.
> By completly different you mean that they do not have common prefix or
> common suffix (at least one of them), isn't it?
Yes, but I also don't highlight lines which prefix/suffix consists only
of whitespace (This is quite common). I would also consider ignoring
prefixes/suffixes with punctuation, like:
- * I like you.
+ * Alice had a little lamb.
>
> > Combined diffs are not supported but a following commit will change
> > it.
> >
> O.K.
>
> > Signed-off-by: Michał Kiedrowicz <michal.kiedrowicz@gmail.com>
> > ---
> > gitweb/gitweb.perl | 82
> > ++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files
> > changed, 77 insertions(+), 5 deletions(-)
> >
> > diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> > index db61553..1a5b454 100755
> > --- a/gitweb/gitweb.perl
> > +++ b/gitweb/gitweb.perl
> > @@ -2322,7 +2322,7 @@ sub format_cc_diff_chunk_header {
> > # wrap patch (diff) line into a <div> (not to be used for diff
> > headers), # the line must be esc_html()'ed
> > sub format_diff_line {
> > - my ($line, $diff_class, $from, $to) = @_;
> > + my ($line, $diff_class) = @_;
>
> Why that change?
I think it fallout from previous patch where format_diff_line() stopped
using $from and $to. Will fix that.
>
> >
> > my $diff_classes = "diff";
> > $diff_classes .= " $diff_class" if ($diff_class);
> > @@ -4923,14 +4923,85 @@ sub print_inline_diff_lines {
> > print foreach (@$add);
> > }
> >
> > +# Highlight characters from $prefix to $suffix and escape HTML.
> > +# $str is a reference to the array of characters.
> > +sub esc_html_mark_range {
> > + my ($str, $prefix, $suffix) = @_;
> > +
> > + # Don't generate empty <span> element.
> > + if ($prefix == $suffix + 1) {
> > + return esc_html(join('', @$str), -nbsp=>1);
> > + }
> > +
> > + my $before = join('', @{$str}[0..($prefix - 1)]);
> > + my $marked = join('', @{$str}[$prefix..$suffix]);
> > + my $after = join('', @{$str}[($suffix + 1)..$#{$str}]);
>
> Eeeeeek! First you split into letters, in caller at that, then join?
> Why not pass striung ($str suggests string not array of characters),
> and use substr instead?
>
> [Please disregard this and the next paragraph at first reading]
I will rename $str to something more self describing.
>
> > +
> > + return esc_html($before, -nbsp=>1) .
> > + $cgi->span({-class=>'marked'}, esc_html($marked,
> > -nbsp=>1)) .
> > + esc_html($after,-nbsp=>1);
> > +}
>
> Anyway I have send to git mailing list a patch series, which in one of
> patches adds esc_html_match_hl($str, $regexp) to highlight matches in
> a string. Your esc_html_mark_range(), after a generalization, could
> be used as underlying "engine".
>
> Something like this, perhaps (untested):
>
> # Highlight selected fragments of string, using given CSS class,
> # and escape HTML. It is assumed that fragments do not overlap.
> # Regions are passed as list of pairs (array references).
> sub esc_html_hl {
> my ($str, $css_class, @sel) = @_;
> return esc_html($str) unless @sel;
>
> my $out = '';
> my $pos = 0;
>
> for my $s (@sel) {
> $out .= esc_html(substr($str, $pos, $s->[0] - $pos))
> if ($s->[0] - $pos > 0);
> $out .= $cgi->span({-class => $css_class},
> esc_html(substr($str, $s->[0],
> $s->[1] - $s->[0])));
>
> $pos = $m->[1];
> }
> $out .= esc_html(substr($str, $pos))
> if ($pos < length($str));
>
> return $out;
> }
>
> > +
> > +# Format removed and added line, mark changed part and HTML-format
> > them.
>
> You should probably ad here that this code is taken from
> diff-highlight in contrib area, isn't it?
True.
>
> > +sub format_rem_add_line {
> > + my ($rem, $add) = @_;
> > + my @r = split(//, $rem);
> > + my @a = split(//, $add);
> > + my ($esc_rem, $esc_add);
> > + my ($prefix, $suffix_rem, $suffix_add) = (1, $#r, $#a);
>
> It is not as much $prefix, as $prefix_len, isn't it?
Yes.
> Shouldn't
> $prefix / $prefix_len start from 0, not from 1?
It starts from 1 because it skips first +/-. It should become obvious
after reading the comment from last patch :).
+ # In combined diff we must ignore two +/- characters.
+ $prefix = 2 if ($is_combined);
+
>
> > + my ($prefix_is_space, $suffix_is_space) = (1, 1);
> > +
> > + while ($prefix < @r && $prefix < @a) {
> > + last if ($r[$prefix] ne $a[$prefix]);
> > +
> > + $prefix_is_space = 0 if ($r[$prefix] !~ /\s/);
> > + $prefix++;
> > + }
>
> Ah, I see that it is easier to find common prefix by treating string
> as array of characters.
>
> Though I wonder if it wouldn't be easier to use trick of XOR-ing two
> strings (see "Bitwise String Operators" in perlop(1)):
>
> my $xor = "$rem" ^ "$add";
>
> and finding starting sequence of "\0", which denote common prefix.
>
>
> Though this and the following is a nice implementation of
> algorithm... as it would be implemented in C. Nevermind, it might be
> good enough...
The splitting and comparing by characters is taken from diff-highlight.
I don't think it's worth changing here.
>
> > +
> > + while ($suffix_rem >= $prefix && $suffix_add >= $prefix) {
> > + last if ($r[$suffix_rem] ne $a[$suffix_add]);
> > +
> > + $suffix_is_space = 0 if ($r[$suffix_rem] !~ /\s/);
> > + $suffix_rem--;
> > + $suffix_add--;
> > + }
>
> BTW., perhaps using single negative $suffix_len instead of separate
> $suffix_rem_pos and $suffix_add_pos would make code simpler and easier
> to understand?
I'll try that.
>
> > +
> > + # Mark lines that are different from each other, but have
> > some common
> > + # part that isn't whitespace. If lines are completely
> > different, don't
> > + # mark them because that would make output unreadable,
> > especially if
> > + # diff consists of multiple lines.
> > + if (($prefix == 1 && $suffix_rem == $#r && $suffix_add ==
> > $#a)
> > + || ($prefix_is_space && $suffix_is_space)) {
>
> Micronit about style: in gitweb we put boolean operator at the end of
> continued line, not at beginning of next one.
>
> So this would be:
>
> + if (($prefix == 1 && $suffix_rem == $#r && $suffix_add ==
> $#a) ||
> + ($prefix_is_space && $suffix_is_space)) {
>
OK
> > + $esc_rem = esc_html($rem);
> > + $esc_add = esc_html($add);
> > + } else {
> > + $esc_rem = esc_html_mark_range(\@r, $prefix,
> > $suffix_rem);
> > + $esc_add = esc_html_mark_range(\@a, $prefix,
> > $suffix_add);
> > + }
> > +
> > + return format_diff_line($esc_rem, 'rem'),
> > + format_diff_line($esc_add, 'add');
>
> Please use spaces to align.
OK
>
> > +}
> > +
> > # HTML-format diff context, removed and added lines.
> > sub format_ctx_rem_add_lines {
> > - my ($ctx, $rem, $add) = @_;
> > + my ($ctx, $rem, $add, $is_combined) = @_;
> > my (@new_ctx, @new_rem, @new_add);
> > + my $num_add_lines = @$add;
>
> Why is this temporary variable needed? If you are not sure that ==
> operator enforces scalar context on both arguments you can always
> write
>
> scalar @$add == scalar @$rem
>
You read my mind.
> > +
> > + if (!$is_combined && $num_add_lines > 0 && $num_add_lines
> > == @$rem) {
> > + for (my $i = 0; $i < $num_add_lines; $i++) {
> > + my ($line_rem, $line_add) =
> > format_rem_add_line(
> > + $rem->[$i], $add->[$i]);
> > + push @new_rem, $line_rem;
> > + push @new_add, $line_add;
>
> The original contrib/diff-highlight works only for single changed line
> (single removed and single added). You make this code work also for
> the case where number of aded lines is equal to the number of removed
> lines, and assume that subsequent changed lines in preimage
> correcponds to subsequent changed lines in postimage, which is not
> always true:
>
> -foo
> -bar
> +baz
> +fooo
>
> This is not described in commit message, I think.
True. Note that in this particular case nothing should be highlighted
because corresponding lines don't have common prefix/suffix.
>
> > + }
> > + } else {
> > + @new_rem = map { format_diff_line(esc_html($_,
> > -nbsp=>1), 'rem') } @$rem;
> > + @new_add = map { format_diff_line(esc_html($_,
> > -nbsp=>1), 'add') } @$add;
> > + }
> >
> > @new_ctx = map { format_diff_line(esc_html($_, -nbsp=>1),
> > 'ctx') } @$ctx;
> > - @new_rem = map { format_diff_line(esc_html($_, -nbsp=>1),
> > 'rem') } @$rem;
> > - @new_add = map { format_diff_line(esc_html($_, -nbsp=>1),
> > 'add') } @$add;
> > return (\@new_ctx, \@new_rem, \@new_add);
> > }
> > @@ -4939,7 +5010,8 @@ sub format_ctx_rem_add_lines {
> > sub print_diff_lines {
> > my ($ctx, $rem, $add, $diff_style, $is_combined) = @_;
> >
> > - ($ctx, $rem, $add) = format_ctx_rem_add_lines($ctx, $rem,
> > $add);
> > + ($ctx, $rem, $add) = format_ctx_rem_add_lines($ctx, $rem,
> > $add,
> > + $is_combined);
>
> O.K., now the code depends on $is_combined
>
^ permalink raw reply
* Re: [PATCH 7/8] gitweb: Use different colors to present marked changes
From: Michal Kiedrowicz @ 2012-02-13 6:46 UTC (permalink / raw)
To: Jakub Narebski; +Cc: git
In-Reply-To: <m3pqdksyg1.fsf@localhost.localdomain>
Jakub Narebski <jnareb@gmail.com> wrote:
> Michał Kiedrowicz <michal.kiedrowicz@gmail.com> writes:
>
> > This makes use of the highlight diff feature.
> >
> > Signed-off-by: Michał Kiedrowicz <michal.kiedrowicz@gmail.com>
> > ---
> > I decided to split mechanism (generate HTML page with <span>
> > elements that mark interesting fragments of diff output) from
> > politics (use these particular colors for this <span> elements),
> > but otherwise this commit may be squashed with the previous one.
> > These colors work for me but if someone comes out with better ones,
> > I'd be happy.
>
> I think it would be better squashed with previous patch, otherwise it
> is a bit not visible change...
OK, but please note that since previous patch HTML contains <span>
elements around differing segments of diff so the change exists. It
just isn't reflected by CSS.
>
> > gitweb/static/gitweb.css | 8 ++++++++
> > 1 files changed, 8 insertions(+), 0 deletions(-)
> >
> > diff --git a/gitweb/static/gitweb.css b/gitweb/static/gitweb.css
> > index c7827e8..4f87d16 100644
> > --- a/gitweb/static/gitweb.css
> > +++ b/gitweb/static/gitweb.css
> > @@ -438,6 +438,10 @@ div.diff.add {
> > color: #008800;
> > }
> >
> > +div.diff.add span.marked {
> > + background-color: #77ff77;
> > +}
> > +
> > div.diff.from_file a.path,
> > div.diff.from_file {
> > color: #aa0000;
> > @@ -447,6 +451,10 @@ div.diff.rem {
> > color: #cc0000;
> > }
> >
> > +div.diff.rem span.marked {
> > + background-color: #ff7777;
> > +}
> > +
> > div.diff.chunk_header a,
> > div.diff.chunk_header {
> > color: #990099;
> > --
>
> I'd have to see those colors in use.
Then why don't you try it?
> BTW what colors other
> highlighting diff GUIs use?
>
AFAIK they just use darker red/green background than for the rest of
line.
^ permalink raw reply
* Re: [PATCH 8/8] gitweb: Highlight combined diffs
From: Michal Kiedrowicz @ 2012-02-13 6:48 UTC (permalink / raw)
To: Jakub Narebski; +Cc: git
In-Reply-To: <m3ty2wsyt6.fsf@localhost.localdomain>
Jakub Narebski <jnareb@gmail.com> wrote:
> Michał Kiedrowicz <michal.kiedrowicz@gmail.com> writes:
>
> > The highlightning of combined diffs is currently disabled. This is
> > because output from a combined diff is much harder to highlight
> > because it's not obvious which removed and added lines should be
> > compared.
> >
> > Moreover, code that compares added and removed lines doesn't care
> > about combined diffs. It only skips first +/- character, treating
> > second +/- as a line content.
> >
> > Let's start with a simple case: only highlight changes that come
> > from one parent, i.e. when every removed line has a corresponding
> > added line for the same parent. This way the highlightning cannot
> > get wrong. For example, following diffs would be highlighted:
> >
> > - removed line for first parent
> > + added line for first parent
> > context line
> > -removed line for second parent
> > +added line for second parent
> >
> > or
> >
> > - removed line for first parent
> > -removed line for second parent
> > + added line for first parent
> > +added line for second parent
> >
> > but following output will not:
> >
> > - removed line for first parent
> > -removed line for second parent
> > +added line for second parent
> > ++added line for both parents
> >
> That is a very reasonable approach.
Thanks.
>
> > Further changes may introduce more intelligent approach that better
> > handles combined diffs.
> >
> > Signed-off-by: Michał Kiedrowicz <michal.kiedrowicz@gmail.com>
> > ---
> > gitweb/gitweb.perl | 40 +++++++++++++++++++++++++++++++++++++---
> > 1 files changed, 37 insertions(+), 3 deletions(-)
> >
> > diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> > index 1a5b454..2b6cb9e 100755
> > --- a/gitweb/gitweb.perl
> > +++ b/gitweb/gitweb.perl
> > @@ -4944,13 +4944,16 @@ sub esc_html_mark_range {
> >
> > # Format removed and added line, mark changed part and HTML-format
> > them. sub format_rem_add_line {
> > - my ($rem, $add) = @_;
> > + my ($rem, $add, $is_combined) = @_;
> > my @r = split(//, $rem);
> > my @a = split(//, $add);
> > my ($esc_rem, $esc_add);
> > my ($prefix, $suffix_rem, $suffix_add) = (1, $#r, $#a);
> > my ($prefix_is_space, $suffix_is_space) = (1, 1);
> >
> > + # In combined diff we must ignore two +/- characters.
> > + $prefix = 2 if ($is_combined);
> > +
>
> Errr... actually number of prefix is equalt to number of parents, so
> it might be in case of octopus merge more than 2.
OK
>
> > while ($prefix < @r && $prefix < @a) {
> > last if ($r[$prefix] ne $a[$prefix]);
> >
> > @@ -4988,11 +4991,42 @@ sub format_ctx_rem_add_lines {
> > my ($ctx, $rem, $add, $is_combined) = @_;
> > my (@new_ctx, @new_rem, @new_add);
> > my $num_add_lines = @$add;
> > + my $can_highlight;
> > +
> > + # Highlight if every removed line has a corresponding
> > added line.
> > + if ($num_add_lines > 0 && $num_add_lines == @$rem) {
> > + $can_highlight = 1;
> > +
> > + # Highlight lines in combined diff only if the
> > chunk contains
> > + # diff between the same version, e.g.
> > + #
> > + # - a
> > + # - b
> > + # + c
> > + # + d
> > + #
> > + # Otherwise the highlightling would be confusing.
> > + if ($is_combined) {
> > + for (my $i = 0; $i < $num_add_lines; $i++)
> > {
> > + my $prefix_rem =
> > substr($rem->[$i], 0, 2);
> > + my $prefix_add =
> > substr($add->[$i], 0, 2); +
> > + $prefix_rem =~ s/-/+/g;
> > +
> > + if ($prefix_rem ne $prefix_add) {
> > + $can_highlight = 0;
> > + last;
>
> Nb. this assumes that we cannot refine and highlight something like
> this:
>
> # - a
> # - b
> # + c
> # ++ d
>
> But perhaps this is better left for future improvemnt.
I can add a patch for that at the end of this series.
>
> > + }
> > + }
> > + }
> > + } else {
> > + $can_highlight = 0;
> > + }
>
> This 'else' would be not necessary if $can_highlight was initialized
> to 0.
>
OK.
> >
> > - if (!$is_combined && $num_add_lines > 0 && $num_add_lines
> > == @$rem) {
> > + if ($can_highlight) {
> > for (my $i = 0; $i < $num_add_lines; $i++) {
> > my ($line_rem, $line_add) =
> > format_rem_add_line(
> > - $rem->[$i], $add->[$i]);
> > + $rem->[$i], $add->[$i],
> > $is_combined); push @new_rem, $line_rem;
> > push @new_add, $line_add;
>
> O.K.
>
Thanks for your thorough review.
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox