$Test::Builder::Test was only made into an `our' variable in 0.94
released in September 2009, older distros are more likely to have 0.92
or earlier. Use the singleton Test::More->builder constructor instead.
The exit() call was also unportable to <0.94. Just output a meaningful
exit code if the ->is_passing method exists. The t9700-perl-git.sh
test only cares about stderr output, so this doesn't affect test
results when using older Test::More modules.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
In some use cases it is not desirable that "git status" considers
submodules that only contain untracked content as dirty. This may happen
e.g. when the submodule is not under the developers control and not all
build generated files have been added to .gitignore by the upstream
developers. Using the "untracked" parameter for the "--ignore-submodules"
option disables checking for untracked content and lets git diff report
them as changed only when they have new commits or modified content.
Sometimes it is not wanted to have submodules show up as changed when they
just contain changes to their work tree (this was the behavior before
1.7.0). An example for that are scripts which just want to check for
submodule commits while ignoring any changes to the work tree. Also users
having large submodules known not to change might want to use this option,
as the - sometimes substantial - time it takes to scan the submodule work
tree(s) is saved when using the "dirty" parameter.
And if you want to ignore any changes to submodules, you can now do that
by using this option without parameters or with "all" (when the config
option status.submodulesummary is set, using "all" will also suppress the
output of the submodule summary).
A new function handle_ignore_submodules_arg() is introduced to parse this
option new to "git status" in a single location, as "git diff" already
knew it.
Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
The tests used a mixture of 'echo -n' (which is non-portable) and either
test_cmp or diff to check if a file is empty. The much easier and portable
method to check for an empty file is '! test -s'
While we're in t4027, there was an excess test_done. Remove it.
Signed-off-by: Brian Gernhardt <brian@gernhardtsoftware.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Internally, --track and --orphan still use the 'safe' -b, not -B.
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Lines that begin with "ok" confuse the TAP harness because it can't
distinguish them from a test counter. Work around the issue by saying
"pass" instead, which isn't a reserved TAP word.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
SKIP messages are now part of the TAP plan. A TAP harness now knows
why a particular test was skipped and can report that information. The
non-TAP harness built into Git's test-lib did nothing special with
these messages, and is unaffected by these changes.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Some tests in the testsuite will emit a line that doesn't end with a
newline, right before we're about to output "ok" or "not ok". This
breaks the TAP output with "Tests out of sequence" errors since a TAP
harness can't understand this:
ok 1 - A test
[some output here]ok 2 - Another test
ok 3 - Yet another test
Work around it by emitting an empty line before we're about to say
"ok" or "not ok", but only if we're running under --verbose and
HARNESS_ACTIVE=1 is set, which'll only be the case when running under
a harnesses like prove(1).
I think it's better to do this than fix each tests by adding `&& echo'
everywhere. More tests might be added that break TAP in the future,
and a human isn't going to look at the extra whitespace, since
HARNESS_ACTIVE=1 always means a harness is reading it.
The tests that had issues were:
t1007, t3410, t3413, t3409, t3414, t3415, t3416, t3412, t3404,
t5407, t7402, t7003, t9001
With this workaround the entire test suite runs without errors under:
prove -j 10 ./t[0-9]*.sh :: --verbose
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Before TAP we just ran the Perl test and assumed that it failed if
nothing was printed on STDERR. Continue doing that, but introduce a
`test_external_has_tap' variable which tests can set to indicate that
they're outputting TAP.
If it's set we won't output a test plan, but trust the external test
to do so. That way we can make external tests work with a TAP harness,
but still maintain compatibility with test-lib's own way of tracking
tests through the test-results directory.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
TAP, the Test Anything Protocol, is a simple text-based interface
between testing modules in a test harness. test-lib.sh's output was
already very close to being valid TAP. This change brings it all the
way there. Before:
$ ./t0005-signals.sh
* ok 1: sigchain works
* passed all 1 test(s)
And after:
$ ./t0005-signals.sh
ok 1 - sigchain works
# passed all 1 test(s)
1..1
The advantage of using TAP is that any program that reads the format
(a "test harness") can run the tests. The most popular of these is the
prove(1) utility that comes with Perl. It can run tests in parallel,
display colored output, format the output to console, file, HTML etc.,
and much more. An example:
$ prove ./t0005-signals.sh
./t0005-signals.sh .. ok
All tests successful.
Files=1, Tests=1, 0 wallclock secs ( 0.03 usr 0.00 sys + 0.01 cusr 0.02 csys = 0.06 CPU)
Result: PASS
prove(1) gives you human readable output without being too
verbose. Running the test suite in parallel with `make test -j15`
produces a flood of text. Running them with `prove -j 15 ./t[0-9]*.sh`
makes it easy to follow what's going on.
All this patch does is re-arrange the output a bit so that it conforms
with the TAP spec, everything that the test suite did before continues
to work. That includes aggregating results in t/test-results/, the
--verbose, --debug and other options for tests, and the test color
output.
TAP harnesses ignore everything that they don't know about, so running
the tests with --verbose works:
$ prove ./t0005-signals.sh :: --verbose --debug
./t0005-signals.sh .. Terminated
./t0005-signals.sh .. ok
All tests successful.
Files=1, Tests=1, 0 wallclock secs ( 0.02 usr 0.01 sys + 0.01 cusr 0.01 csys = 0.05 CPU)
Result: PASS
Just supply the -v option to prove itself to get all the verbose
output that it suppresses:
$ prove -v ./t0005-signals.sh :: --verbose --debug
./t0005-signals.sh ..
Initialized empty Git repository in /home/avar/g/git/t/trash directory.t0005-signals/.git/
expecting success:
test-sigchain >actual
case "$?" in
143) true ;; # POSIX w/ SIGTERM=15
3) true ;; # Windows
*) false ;;
esac &&
test_cmp expect actual
Terminated
ok 1 - sigchain works
# passed all 1 test(s)
1..1
ok
All tests successful.
Files=1, Tests=1, 0 wallclock secs ( 0.02 usr 0.00 sys + 0.01 cusr 0.01 csys = 0.04 CPU)
Result: PASS
As a further example, consider this test script that uses a lot of
test-lib.sh features by Jakub Narebski:
#!/bin/sh
test_description='this is a sample test.
This test is here to see various test outputs.'
. ./test-lib.sh
say 'diagnostic message'
test_expect_success 'true test' 'true'
test_expect_success 'false test' 'false'
test_expect_failure 'true test (todo)' 'true'
test_expect_failure 'false test (todo)' 'false'
test_debug 'echo "debug message"'
test_done
The output of that was previously:
* diagnostic message # yellow
* ok 1: true test
* FAIL 2: false test # bold red
false
* FIXED 3: true test (todo)
* still broken 4: false test (todo) # bold green
* fixed 1 known breakage(s) # green
* still have 1 known breakage(s) # bold red
* failed 1 among remaining 3 test(s) # bold red
But is now:
diagnostic message # yellow
ok 1 - true test
not ok - 2 false test # bold red
# false
ok 3 - true test (todo) # TODO known breakage
not ok 4 - false test (todo) # TODO known breakage # bold green
# fixed 1 known breakage(s) # green
# still have 1 known breakage(s) # bold red
# failed 1 among remaining 3 test(s) # bold red
1..4
All the coloring is preserved when the test is run manually. Under
prove(1) the test performs as expected, even with --debug and
--verbose options:
$ prove ./example.sh :: --debug --verbose
./example.sh .. Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/4 subtests
(1 TODO test unexpectedly succeeded)
Test Summary Report
-------------------
./example.sh (Wstat: 256 Tests: 4 Failed: 1)
Failed test: 2
TODO passed: 3
Non-zero exit status: 1
Files=1, Tests=4, 0 wallclock secs ( 0.02 usr 0.00 sys + 0.00 cusr 0.01 csys = 0.03 CPU)
Result: FAIL
The TAP harness itself doesn't get confused by the color output, they
aren't used by test-lib.sh stdout isn't open to a terminal (test -t 1).
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This can be useful to do something like:
git rev-list --reverse master -- README | git cherry-pick -n --stdin
without using xargs.
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
* cc/cherry-pick-series:
Documentation/revert: describe passing more than one commit
Documentation/cherry-pick: describe passing more than one commit
revert: add tests to check cherry-picking many commits
revert: allow cherry-picking more than one commit
revert: change help_msg() to take no argument
revert: refactor code into a do_pick_commit() function
revert: use run_command_v_opt() instead of execv_git_cmd()
revert: cleanup code for -x option
* jc/rev-list-ancestry-path:
revision: Turn off history simplification in --ancestry-path mode
revision: Fix typo in --ancestry-path error message
Documentation/rev-list-options.txt: Explain --ancestry-path
Documentation/rev-list-options.txt: Fix missing line in example history graph
revision: --ancestry-path
* tc/merge-m-log:
merge: --log appends shortlog to message if specified
fmt-merge-msg: add function to append shortlog only
fmt-merge-msg: refactor merge title formatting
fmt-merge-msg: minor refactor of fmt_merge_msg()
merge: rename variable
merge: update comment
t7604-merge-custom-message: show that --log doesn't append to -m
t7604-merge-custom-message: shift expected output creation
* pc/remove-warn:
Remove a redundant errno test in a usage of remove_path
Introduce remove_or_warn function
Implement the rmdir_or_warn function
Generalise the unlink_or_warn function
As Brandon noticed, a regular expression match given to 'expr' is already
anchored at the beginning. Some versions of expr even complain about this.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
The fake "less" script was already created in a previous test titled
'setup: fake "less"', so it is redundant. Additionally, it is broken since
the redirection of 'cat' is to a file named 'less', but the chmod operates
on the file named by the $less variable which may not contain the value
'less'.
So, just remove this code, and rely on the creation of the fake "less"
script performed earlier within the test script.
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
The fake "less" script was not being made executable. This can cause the
tests that follow to fail. This failure is not apparent on platforms which
have DEFAULT_PAGER set to the string "less", since lib-pager.sh will have
set the $less variable to "less" and the SIMPLEPAGER prerequisite will have
been set, and so the "less" script will have already been created properly
and made executable in test 2 'git grep -O'. On platforms which set
DEFAULT_PAGER to something like "more", no such script will have been
previously created, and tests 7 and 8 will fail.
So, add a call to chmod to make the fake "less" script executable.
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Regular expressions matched by 'expr' have an implicit '^' at the beginning
of them and so are anchored to the beginning of the string. Using the '^'
character to mean "match at the beginning", is redundant and could produce
the wrong result if 'expr' implementations interpret the '^' as a literal
'^'. Additionally, GNU expr 5.97 complains like this:
expr: warning: unportable BRE: `^[a-z][a-z]*$': using `^' as the first character of the basic regular expression is not portable; it is being ignored
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
* js/async-thread:
fast-import: die_nicely() back to vsnprintf (reverts part of ebaa79f)
Enable threaded async procedures whenever pthreads is available
Dying in an async procedure should only exit the thread, not the process.
Reimplement async procedures using pthreads
Windows: more pthreads functions
Fix signature of fcntl() compatibility dummy
Make report() from usage.c public as vreportf() and use it.
Modernize t5530-upload-pack-error.
Conflicts:
http-backend.c
* gv/portable:
test-lib: use DIFF definition from GIT-BUILD-OPTIONS
build: propagate $DIFF to scripts
Makefile: Tru64 portability fix
Makefile: HP-UX 10.20 portability fixes
Makefile: HPUX11 portability fixes
Makefile: SunOS 5.6 portability fix
inline declaration does not work on AIX
Allow disabling "inline"
Some platforms lack socklen_t type
Make NO_{INET_NTOP,INET_PTON} configured independently
Makefile: some platforms do not have hstrerror anywhere
git-compat-util.h: some platforms with mmap() lack MAP_FAILED definition
test_cmp: do not use "diff -u" on platforms that lack one
fixup: do not unconditionally disable "diff -u"
tests: use "test_cmp", not "diff", when verifying the result
Do not use "diff" found on PATH while building and installing
enums: omit trailing comma for portability
Makefile: -lpthread may still be necessary when libc has only pthread stubs
Rewrite dynamic structure initializations to runtime assignment
Makefile: pass CPPFLAGS through to fllow customization
Conflicts:
Makefile
wt-status.h
* bc/portable:
Remove python 2.5'isms
Makefile: add PYTHON_PATH to GIT-BUILD-OPTIONS
t/aggregate-results: accomodate systems with small max argument list length
t/t7006: ignore return status of shell's unset builtin
t/t5150: remove space from sed script
git-request-pull.sh: remove -e switch to shell interpreter which breaks ksh
t/t5800: skip if python version is older than 2.5
Test the correct functionning of textconv with cat-file <sha1:blob>
and cat-file HEAD^ <file>. Test the case when no driver is specified
Signed-off-by: Clément Poulain <clement.poulain@ensimag.imag.fr>
Signed-off-by: Diane Gasselin <diane.gasselin@ensimag.imag.fr>
Signed-off-by: Axel Bonnet <axel.bonnet@ensimag.imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
* jn/gitweb-plackup:
git-instaweb: Add support for running gitweb via 'plackup'
git-instaweb: Wait for server to start before running web browser
git-instaweb: Remove pidfile after stopping web server
git-instaweb: Configure it to work with new gitweb structure
git-instaweb: Put httpd logs in a "$httpd_only" subdirectory
gitweb: Set default destination directory for installing gitweb in Makefile
gitweb: Move static files into seperate subdirectory
* tc/merge-m-log:
merge: --log appends shortlog to message if specified
fmt-merge-msg: add function to append shortlog only
fmt-merge-msg: refactor merge title formatting
fmt-merge-msg: minor refactor of fmt_merge_msg()
merge: rename variable
merge: update comment
t7604-merge-custom-message: show that --log doesn't append to -m
t7604-merge-custom-message: shift expected output creation
Conflicts:
builtin.h
Test the correct functionning of textconv with blame <file> and blame HEAD^ <file>.
Test the case when no driver is specified.
Signed-off-by: Axel Bonnet <axel.bonnet@ensimag.imag.fr>
Signed-off-by: Clément Poulain <clement.poulain@ensimag.imag.fr>
Signed-off-by: Diane Gasselin <diane.gasselin@ensimag.imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-send-email passes on an 8bit mail as-is even if it does not
declare a content-type. Because the user can edit email between
format-patch and send-email, such invalid mails are unfortunately not
very hard to come by.
Make git-send-email stop and ask about the encoding to use if it
encounters any such mail. Also provide a configuration setting to
permanently configure an encoding.
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
* cb/maint-stash-orphaned-file:
stash tests: stash can lose data in a file removed from the index
stash: Don't overwrite files that have gone from the index
* jn/shortlog:
pretty: Respect --abbrev option
shortlog: Document and test --format option
t4201 (shortlog): Test output format with multiple authors
t4201 (shortlog): guard setup with test_expect_success
Documentation/shortlog: scripted users should not rely on implicit HEAD
* sp/maint-dumb-http-pack-reidx:
http.c::new_http_pack_request: do away with the temp variable filename
http-fetch: Use temporary files for pack-*.idx until verified
http-fetch: Use index-pack rather than verify-pack to check packs
Allow parse_pack_index on temporary files
Extract verify_pack_index for reuse from verify_pack
Introduce close_pack_index to permit replacement
http.c: Remove unnecessary strdup of sha1_to_hex result
http.c: Don't store destination name in request structures
http.c: Drop useless != NULL test in finish_http_pack_request
http.c: Tiny refactoring of finish_http_pack_request
t5550-http-fetch: Use subshell for repository operations
http.c: Remove bad free of static block
* sp/maint-describe-tiebreak-with-tagger-date:
describe: Break annotated tag ties by tagger date
tag.c: Parse tagger date (if present)
tag.c: Refactor parse_tag_buffer to be saner to program
tag.h: Remove unused signature field
tag.c: Correct indentation
* rc/maint-curl-helper:
remote-curl: ensure that URLs have a trailing slash
http: make end_url_with_slash() public
t5541-http-push: add test for URLs with trailing slash
Conflicts:
remote-curl.c
* hg/maint-attr-fix:
attr: Expand macros immediately when encountered.
attr: Allow multiple changes to an attribute on the same line.
attr: Fixed debug output for macro expansion.
* mh/status-optionally-refresh:
t7508: add a test for "git status" in a read-only repository
git status: refresh the index if possible
t7508: add test for "git status" refreshing the index
We have the '+' modifiier which helps combine format specifiers which
may possibly be empty, e.g. '%s%+b%n'.
Introduce an analogous ' ' (space) modifier which adds a space before
non-empty items. This helps assemble "one line type" format specifiers.
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
By default, git uses the version string as the signature for all
patches output by format-patch. Many employers (mine included)
require the use of a signature on all outgoing mails. In a
format-patch | send-email workflow there isn't an easy way to modify
the signature without breaking the pipe and manually replacing the
version string with the signature required. Instead of doing all that
work, add an option (--signature) and a config variable
(format.signature) to replace the default git version signature when
formatting patches.
This does modify the original behavior of format-patch a bit. First
off the version string is now placed in the cover letter by default.
Secondly, once the configuration variable format.signature is added
to the .config file there is no way to revert back to the default
git version signature. Instead, specifying the --no-signature option
will remove the signature from the patches entirely.
Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
In certain situations, commit authorship can consist of an invalid
e-mail address. For example, this is the case when working with git svn
repos where the author email has had the svn repo UUID appended such as:
author@example.com <author@example.com@deadbeef-dead-beef-dead-beefdeadbeef>
Given such an address, mailinfo extracts the authorship incorrectly as
it assumes a valid domain. However, when rebasing the original
authorship should be preserved irrespective of its validity as an email
address.
Using get_author_ident_from_commit instead of mailinfo when rebasing
preserves the original authorship.
Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Each of the tests in t3508 begins by navigating to a sane state:
git checkout master &&
git reset --hard $commit
If a previous test left unmerged files around, they are untouched and
the checkout fails, causing later tests to fail, too. This is not a
problem in practice because no test except the final one produces
unmerged files.
But as a futureproofing measure, it is still best to avoid the problem
with 'checkout -f'. In particular, this is needed for new tests to be
added to the end of the script.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
The following python 2.5 features were worked around:
* the sha module is used as a fallback when the hashlib module is
not available
* the 'any' built-in method was replaced with a 'for' loop
* a conditional expression was replaced with an 'if' statement
* the subprocess.check_call method was replaced by a call to
subprocess.Popen followed by a call to subprocess.wait with a
check of its return status
These changes allow the python infrastructure to be used with python 2.4
which is distributed with RedHat's RHEL 5, for example.
t5800 was updated to check for python >= 2.4 to reflect these changes.
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
* ab/cvsserver:
git-cvsserver: test for pserver authentication support
git-cvsserver: document making a password without htpasswd
git-cvsserver: Improved error handling for pserver
git-cvsserver: indent & clean up authdb code
git-cvsserver: use a password file cvsserver pserver
git-cvsserver: authentication support for pserver
* rs/grep-binary:
grep: support NUL chars in search strings for -F
grep: use REG_STARTEND for all matching if available
grep: continue case insensitive fixed string search after NUL chars
grep: use memmem() for fixed string search
grep: --name-only over binary
grep: --count over binary
grep: grep: refactor handling of binary mode options
grep: add test script for binary file handling
* wp/pretty-enhancement:
pretty: initialize new cmt_fmt_map to 0
pretty: add aliases for pretty formats
pretty: add infrastructure for commit format aliases
pretty: make it easier to add new formats
The environment variable GIT_REFLOG_ACTION was used by git-commit.sh,
but when it was converted to a builtin
(f5bbc3225c, Port git commit to C,
Nov 8 2007) this was lost.
Let's use it again as it is more user friendly when reverting or
cherry-picking to see "revert" or "cherry-pick" in the reflog rather
than to just see "commit".
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Acked-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This attempts to fix a regression in git-commit, where non-abbreviated
SHA-1s were printed in the summary.
One possible fix would be to set ctx.abbrev to DEFAULT_ABBREV in the
`if` block, where format_commit_message() is used.
Instead, we do away with the format_commit_message() codeblock
altogether, replacing it with a re-run of log_tree_commit().
We re-run log_tree_commit() with rev.always_show_header set, to force
the invocation of show_log(). The effect of this flag can be seen from
this excerpt from log-tree.c:560, the only area that
rev.always_show_header is checked:
shown = log_tree_diff(opt, commit, &log);
if (!shown && opt->loginfo && opt->always_show_header) {
log.parent = NULL;
show_log(opt);
shown = 1;
}
We also set rev.use_terminator, so that a newline is appended at the end
of the log message. Note that callers in builtin/log.c that also set
rev.always_show_header don't have to set rev.use_terminator, but still
get a newline, because they are wrapped in a pager.
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9c7304e (print the usage string on stdout instead of stderr,
2010-05-17) broke rev-parse --parseopt: when run with -h, the usage
notice on stdout ended up in the shell eval.
Wrap the usage in a cat <<\EOF ... EOF block when printing to stdout.
I do not expect any usage lines to ever start with EOF so this
shouldn't be an undue burden.
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Suppose you want to edit all files that contain a specific search term.
Of course, you can do something totally trivial such as
git grep -z -e <term> | xargs -0r vi +/<term>
but maybe you are happy that the same will be achieved by
git grep -Ovi <term>
now.
[jn: rebased and added tests]
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Acked-by: Paolo Bonzini <bonzini@gnu.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This adds an option to open the matching files in the pager, and if the
pager happens to be "less" (or "vi") and there is only one grep pattern,
it also jumps to the first match right away.
The short option was chose as '-O' to avoid clashes with GNU grep's
options (as suggested by Junio).
So, 'git grep -O abc' is a short form for 'less +/abc $(grep -l abc)'
except that it works also with spaces in file names, and it does not
start the pager if there was no matching file.
[jn: rebased and added tests; with error handling fix from Junio
squashed in]
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Add a --count option that, instead of actually listing the commits,
merely counts them.
This is mostly geared towards script use, and to this end it acts
specially when used with --left-right: it outputs the left and right
counts separately. Previously, scripts would have to run a shell loop
or small inline script over to achieve the same. (Without
--left-right, a simple |wc -l does the job.)
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
We've had this option since f423ef5 (tests: allow user to specify
trash directory location, 2009-08-09). Make it easier to look up :-)
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Otherwise running individual tests from t/ directory may lack the definition
of $DIFF, $GIT_TEST_CMP and friends.
Noticed and initial patch provided by Thomas Rast, alternative solution
suggested by Brandon Casey, which this patch implements.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Acked-by: Thomas Rast <trast@student.ethz.ch>
In some use cases it is not desirable that the diff family considers
submodules that only contain untracked content as dirty. This may happen
e.g. when the submodule is not under the developers control and not all
build generated files have been added to .gitignore by the upstream
developers. Using the "untracked" parameter for the "--ignore-submodules"
option disables checking for untracked content and lets git diff report
them as changed only when they have new commits or modified content.
Sometimes it is not wanted to have submodules show up as changed when they
just contain changes to their work tree. An example for that are scripts
which just want to check for submodule commits while ignoring any changes
to the work tree. Also users having large submodules known not to change
might want to use this option, as the - sometimes substantial - time it
takes to scan the submodule work tree(s) is saved.
Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
In 86140d5 the new test t4041-diff-submodule.sh was introduced although
t4027-diff-submodule.sh already existed. Rename the newer test to
t4041-diff-submodule-option.sh to fix that.
Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Untracked content in the working tree may prevent rebase -i from checking out
the new base onto which it wants to replay commits, if the new base commit
includes files at those (now untracked) paths. Currently, rebase -i dies
uncleanly in this situation, updating ORIG_HEAD and leaving a useless
.git/rebase-merge directory, with which the user can do nothing useful except
rebase --abort. Make rebase -i abort the procedure itself instead, as
non-interactive rebase already does, and add a test for this behavior.
Signed-off-by: Ian Ward Comfort <icomfort@stanford.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
When one side of a merge turns a directory into a submodule, and the other
side does not touch that directory (but has other non-conflicting changes),
then a merge should succeed. But currently, it does not; it rather fails
with a file/directory conflict.
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
The rebase --preserve-merges facility presents a list of commits
in its instruction sheet and uses a separate table to keep
track of their parents. Unfortunately, in practice this means
that with -p after most attempts to rearrange patches, some
commits have the "wrong" parent and the resulting history is
rarely what the caller expected.
Yes, it would be nice to fix that. But first, add a warning to the
manual to help the uninitiated understand what is going on.
Reported-by: Jiří Paleček <jpalecek@web.de>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Introduce a new configuration variable, "core.eol", that allows the user
to set which line endings to use for end-of-line-normalized files in the
working directory. It defaults to "native", which means CRLF on Windows
and LF everywhere else.
Note that "core.autocrlf" overrides core.eol. This means that
[core]
autocrlf = true
puts CRLFs in the working directory even if core.eol is set to "lf".
Signed-off-by: Eyvind Bernhardsen <eyvind.bernhardsen@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
A bug was introduced in 3e97c7c6af
(No diff -b/-w output for all-whitespace changes, Nov 19 2009)
that made the lines:
diff --git a/bar b/sub/bar
similarity index 100%
rename from bar
rename to sub/bar
disappear from "git show -C -C" output when file bar is a binary
file.
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
When using --ancestry-path together with history simplification (typically
triggered by path limiting), history simplification would get in the way of
--ancestry-path by prematurely removing the parent links between commits on
which the ancestry path calculations are made.
This patch disables this history simplification when --ancestry-path is
enabled. This is similar to what e.g. --full-history already does.
The patch also includes a simple testcase verifying that --ancestry-path
works together with path limiting.
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git ls-files used to error out if given paths which point outside the current
working directory, such as '../'. We now allow such paths and the output is
analogous to git grep -l.
Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
By default reflogs are always created for new local branches by
"checkout -b". But by setting core.logAllRefUpdates to false this will
not be true anymore.
In that case you only create the reflogs when you use -l switch with
"checkout -b".
Added missing tests to check expected behaviors.
Signed-off-by: Erick Mattos <erick.mattos@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Added changes to satisfy a corner case: creating reflogs by using -l
when core.logAllRefUpdates is set to false.
Signed-off-by: Erick Mattos <erick.mattos@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
The UTF-8 prerequisite test checked explicitly for en_US.utf8 in the
output from "locale -a", but the tests that are actually protected by the
prerequisite were asking LC_ALL=en_US.UTF-8 from the system.
This inconsistency leads the tests to fail on platforms that do not know
both en_US.UTF-8 and en_US.utf8 (thanks you, Yann Droneaud, for bringing
this up with an initial patch).
Instead, pick a locale with ".UTF-8" (with or without hyphen, spelled in
either upper or lowercase) in its name from "locale -a" output, and use it
for running the test.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Note that there is an expected failure when running:
git cherry-pick -3 fourth
that's because:
git rev-list --no-walk -3 fourth
produce only one commit and not 3 as "--no-walk" seems to
take over "-3".
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
IRIX 6.5 has a default maximum argument list length of 20480. The file
glob that is passed to aggregate-results currently exceeds this length, and
so the script cannot run successfully. Work around this issue by passing
the file names in via the standard input rather than the argument list.
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
The unset builtin of Solaris's xpg4/sh returns non-zero if it is passed a
variable name which was not previously set. Since the unset is not likely
to fail, ignore its return status, but add a semicolon as a clue that the
'&&' was deliberately left off.
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Acked-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Solaris's xpg4/sed and IRIX's sed fail to parse these negated matching
expressions when the '!' is separated from the command that follows.
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Acked-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This test script depends on the git-remote-testgit python script. This
python script makes use of the hashlib module which was released in python
version 2.5. So, add a new pre-requisite named PYTHON_2_5_OR_NEWER to
test-lib.sh and check for it in t5800.
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
When -h is used, print usage messages on stdout. If a command is invoked with
wrong arguments then print the usage messages on stderr.
Signed-off-by: Giuseppe Scrivano <gscrivano@gnu.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Create a new subdirectory called 'static' in gitweb/, and move
all static files required by gitweb.cgi when running, which means
styles, images and Javascript code. This should make gitweb more
readable and easier to maintain.
Update t/gitweb-lib.sh to reflect this change.The install-gitweb
now also include moving of static files into 'static' subdirectory
in target directory: update Makefile, gitweb's INSTALL, README and
Makefile accordingly.
Signed-off-by: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>
Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Mentored-by: Petr Baudis <pasky@ucw.cz>
Acked-by: Jakub Narebski <jnareb@gmail.com>
Acked-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Strip out options before checking for a missing upstream argument.
Before:
$ git rebase -m
shift: 426: can't shift that many
After:
$ git rebase -m
Usage: git rebase ...
While at it, fix the usage message to explain that the upstream
argument is mandatory.
Reported-by: Jon Dowland <jmtd@debian.org>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
In the metainfo section of git diffs there's an "index" line providing
abbreviated (unless --full-index is used) blob SHA1s from the
pre-/post-images used to generate the diff. These provide hints that
can be used to reconstruct a 3-way merge when applying the patch
(see the --3way option to 'git am' for more details).
In order for this to work, however, the blob SHA1s must not be
abbreviated into ambiguity.
This patch eliminates the possible ambiguity by using find_unique_abbrev()
to produce the abbreviated SHA1s (instead of blind abbreviation by way of
"%.*s").
A testcase verifying the fix is also included.
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
By default the testsuite calls 'diff -u' whenever a file comparison is
called for. Unfortunately that throws a "diff: unknown option '-u'"
error for most non-GNU diffs.
This patch sets GIT_TEST_CMP to 'cmp' on all the architectures where
that happens. The previous version of this patch forgot to export
GIT_TEST_CMP from t/Makefile, which is why 'make test' continued to
fail most tests on most architectures - test-lib.sh was falling back
on its default of `diff -u' for GIT_TEST_CMP. This version of this
patch shows a vast improvement in testsuite results where either GNU
diff is in the path at configure time, or where Makefile knows that
GIT_TEST_CMP=cmp is required.
Signed-off-by: Gary V. Vaughan <gary@thewrittenword.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
In tests, call test_cmp rather than raw diff where possible (i.e. if
the output does not go to a pipe), to allow the use of, say, 'cmp'
when the default 'diff -u' is not compatible with a vendor diff.
When that is not possible, use $DIFF, as set in GIT-BUILD-OPTIONS.
Signed-off-by: Gary V. Vaughan <gary@thewrittenword.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
* maint:
Makefile: reenable install with NO_CURL
completion: --set-upstream option for git-branch
get_cwd_relative(): do not misinterpret suffix as subdirectory
After c197702 (pretty: Respect --abbrev option), non-abbreviated hashes
began to appear, leading to failures for these tests.
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
daae1922 (fsck: check ident lines in commit objects, 2010-04-24)
taught fsck to expect commit objects to have the form
tree <object name>
<parents>
author <valid ident string>
committer <valid ident string>
log message
The check is overly strict: for example, it errors out with the
message “expected blank line” for perfectly valid commits with an
"encoding ISO-8859-1" line.
Later it might make sense to teach fsck about the rest of the header
and warn about unrecognized header lines, but for simplicity, let’s
accept arbitrary trailing lines for now.
Reported-by: Tuncer Ayaz <tuncer.ayaz@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
If the current working directory is the same as the work tree path
plus a suffix, e.g. 'work' and 'work-xyz', then the suffix '-xyz'
would be interpreted as a subdirectory of 'work'.
Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
* maint:
Documentation/SubmittingPatches: clarify GMail section and SMTP
show-branch: use DEFAULT_ABBREV instead of 7
t7502-commit: fix spelling
test get_git_work_tree() return value for NULL
Add a $toplevel variable accessible to `git submodule foreach`, it
contains the absolute path of the top level directory (where
.gitmodules is).
This makes it possible to e.g. read data in .gitmodules from within
foreach commands. I'm using this to configure the branch names I want
to track for each submodule:
git submodule foreach 'git checkout $(git config --file $toplevel/.gitmodules submodule.$name.branch) && git pull'
For a little history: This patch is borne out of my continuing fight
of trying to have Git track the branches of submodules, not just their
commits.
Obviously that's not how they work (they only track commits), but I'm
just interested in being able to do:
git submodule foreach 'git pull'
Of course that won't work because the submodule is in a disconnected
head, so I first have to connect it, but connect it *to what*.
For a while I was happy with this because as fate had it, it just so
happened to do what I meant:
git submodule foreach 'git checkout $(git describe --all --always) && git pull'
But then that broke down, if there's a tag and a branch the tag will
win out, and I can't git pull a branch:
$ git branch -a
* master
remotes/origin/HEAD -> origin/master
remotes/origin/master
$ git tag -l
release-0.0.6
$ git describe --always --all
release-0.0.6
So I figured that I might as well start tracking the branches I want
in .gitmodules itself:
[submodule "yaml-mode"]
path = yaml-mode
url = git://github.com/yoshiki/yaml-mode.git
branch = master
So now I can just do (as stated above):
git submodule foreach 'git checkout $(git config --file $toplevel/.gitmodules submodule.$name.branch) && git pull'
Maybe there's a less painful way to do *that* (I'd love to hear about
it). But regardless of that I think it's a good idea to be able to
know what the top-level is from git submodule foreach.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
We generally treat these as equivalent to "/path/to/repo"
and "host:path_to_repo" respectively. However, they are URLs
and as such may be percent-encoded. The current code simply
uses them as-is without any decoding.
With this patch, we will now percent-decode any file:// or
ssh:// url (or ssh+git, git+ssh, etc) at the transport
layer. We continue to treat plain paths and "host:path"
syntax literally.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Search patterns in a file specified with -f can contain NUL characters.
The current code ignores all characters on a line after a NUL.
Pass the actual length of the line all the way from the pattern file to
fixmatch() and use it for case-sensitive fixed string matching.
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Refactor REG_STARTEND handling inlook_ahead() into a new helper,
regmatch(), and use it for line matching, too. This allows regex
matching beyond NUL characters if regexec() supports the flag. NUL
characters themselves are not matched in any way, though.
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Functions for C strings, like strcasestr(), can't see beyond NUL
characters. Check if there is such an obstacle on the line and try
again behind it.
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Allow searching beyond NUL characters by using memmem() instead of
strstr().
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
As with the option -c/--count, git grep with the option -l/--name-only
should work the same with binary files as with text files because
there is no danger of messing up the terminal with control characters
from the contents of matching files. GNU grep does the same.
Move the check for ->name_only before the one for binary_match_only,
thus making the latter irrelevant for git grep -l.
Reported-by: Dmitry Potapov <dpotapov@gmail.com>
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
The intent of showing the message "Binary file xyz matches" for
binary files is to avoid annoying users by potentially messing up
their terminals by printing control characters. In --count mode,
this precaution isn't necessary.
Display counts of matches if -c/--count was specified, even if -a
was not given. GNU grep does the same.
Moving the check for ->count before the code for handling binary
file also avoids printing context lines if --count and -[ABC] were
used together, so we can remove the part of the comment that
mentions this behaviour. Again, GNU grep does the same.
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
* by/log-follow:
tests: rename duplicate t4205
Make git log --follow find copies among unmodified files.
Make diffcore_std only can run once before a diff_flush
Add a macro DIFF_QUEUE_CLEAR.
* cb/maint-stash-orphaned-file:
stash tests: stash can lose data in a file removed from the index
stash: Don't overwrite files that have gone from the index
* jn/gitweb-caching-prep:
gitweb: Move generating page title to separate subroutine
gitweb: Add custom error handler using die_error
gitweb: Use nonlocal jump instead of 'exit' in die_error
gitweb: href(..., -path_info => 0|1)
Export more test-related variables when running external tests
* jn/request-pull:
tests: chmod +x t5150
adapt request-pull tests for new pull request format
t5150: protect backslash with backslash in shell
request-pull: protect against OPTIONS_KEEPDASHDASH from environment
tests for request-pull
* jn/shortlog:
pretty: Respect --abbrev option
shortlog: Document and test --format option
t4201 (shortlog): Test output format with multiple authors
t4201 (shortlog): guard setup with test_expect_success
Documentation/shortlog: scripted users should not rely on implicit HEAD
* js/maint-receive-pack-symref-alias:
t5516-fetch-push.sh: style cleanup
receive-pack: detect aliased updates which can occur with symrefs
receive-pack: switch global variable 'commands' to a parameter
Conflicts:
t/t5516-fetch-push.sh
* sp/maint-dumb-http-pack-reidx:
http.c::new_http_pack_request: do away with the temp variable filename
http-fetch: Use temporary files for pack-*.idx until verified
http-fetch: Use index-pack rather than verify-pack to check packs
Allow parse_pack_index on temporary files
Extract verify_pack_index for reuse from verify_pack
Introduce close_pack_index to permit replacement
http.c: Remove unnecessary strdup of sha1_to_hex result
http.c: Don't store destination name in request structures
http.c: Drop useless != NULL test in finish_http_pack_request
http.c: Tiny refactoring of finish_http_pack_request
t5550-http-fetch: Use subshell for repository operations
http.c: Remove bad free of static block
* jc/maint-no-reflog-expire-unreach-for-head:
reflog --expire-unreachable: special case entries in "HEAD" reflog
more war on "sleep" in tests
Document gc.<pattern>.reflogexpire variables
Conflicts:
Documentation/config.txt
* sp/maint-describe-tiebreak-with-tagger-date:
describe: Break annotated tag ties by tagger date
tag.c: Parse tagger date (if present)
tag.c: Refactor parse_tag_buffer to be saner to program
tag.h: Remove unused signature field
tag.c: Correct indentation
* sr/remote-helper-export:
t5800: testgit helper requires Python support
Makefile: Simplify handling of python scripts
remote-helpers: add tests for testgit helper
remote-helpers: add testgit helper
remote-helpers: add support for an export command
remote-helpers: allow requesing the path to the .git directory
fast-import: always create marks_file directories
clone: also configure url for bare clones
clone: pass the remote name to remote_get
Conflicts:
Makefile
* ar/config-from-command-line:
Complete prototype of git_config_from_parameters()
Use strbufs instead of open-coded string manipulation
Allow passing of configuration parameters in the command line
* maint:
Fix checkout of large files to network shares on Windows XP
start_command: close cmd->err descriptor when fork/spawn fails
Fix "Out of memory? mmap failed" for files larger than 4GB on Windows
Bigger writes to network drives on Windows XP fail. Cap them at 31MB to
allow them to succeed. Callers need to be prepared for write() calls
that do less work than requested anyway.
On local drives, write() calls are translated to WriteFile() calls with
a cap of 64KB on Windows XP and 256KB on Vista. Thus a cap of 31MB won't
affect the number of WriteFile() calls which do the actual work. There's
still room for some other version of Windows to use a chunk size of 1MB
without increasing the number of system calls.
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Fix the problem where the cmd->err passed into start_command wasn't
being properly closed when certain types of errors occurr. (Compare
the affected code with the clean shutdown code later in the function.)
On Windows, this problem would be triggered if mingw_spawnvpe()
failed, which would happen if the command to be executed was malformed
(e.g. a text file that didn't start with a #! line). If cmd->err was
a pipe, the failure to close it could result in a hang while the other
side was waiting (forever) for either input or pipe close, e.g. while
trying to shove the output into the side band. On msysGit, this
problem was causing a hang in t5516-fetch-push.
[J6t: With a slight adjustment of the test case, the hang is also
observed on Linux.]
Signed-off-by: bert Dvornik <dvornik+git@gmail.com>
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Introduce -n and -v options for "git notes prune" in complete analogy to
"git prune" so that one can check for dangling notes easily.
The output is a list of names of objects whose notes would be resp.
are removed so that one can check the object ("git show sha1") as well as
the note ("git notes show sha1").
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Acked-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Add ‘git remote set-branches’ for changing the list of tracked refs
for a remote repository with one "porcelain-level" command. This
complements the longstanding ‘git remote add --track’ option.
The interface is based on the ‘git remote set-url’ subcommand.
git remote set-branches base --add C
git remote set-branches base A B D
git remote set-branches base --delete D; # not implemented
Suggested-by: martin f. krafft <madduck@debian.org>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
As discussed on the list, "crlf" is not an optimal name. Linus
suggested "text", which is much better.
Signed-off-by: Eyvind Bernhardsen <eyvind.bernhardsen@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Change the semantics of the "crlf" attribute so that it enables
end-of-line normalization when it is set, regardless of "core.autocrlf".
Add a new setting for "crlf": "auto", which enables end-of-line
conversion but does not override the automatic text file detection.
Add a new attribute "eol" with possible values "crlf" and "lf". When
set, this attribute enables normalization and forces git to use CRLF or
LF line endings in the working directory, respectively.
The line ending style to be used for normalized text files in the
working directory is set using "core.autocrlf". When it is set to
"true", CRLFs are used in the working directory; when set to "input" or
"false", LFs are used.
Signed-off-by: Eyvind Bernhardsen <eyvind.bernhardsen@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Introduce a :short modifier to objectname which outputs the abbreviated
object name.
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Previously, autocrlf would only work well for normalized
repositories. Any text files that contained CRLF in the repository
would cause problems, and would be modified when handled with
core.autocrlf set.
Change autocrlf to not do any conversions to files that in the
repository already contain a CR. git with autocrlf set will never
create such a file, or change a LF only file to contain CRs, so the
(new) assumption is that if a file contains a CR, it is intentional,
and autocrlf should not change that.
The following sequence should now always be a NOP even with autocrlf
set (assuming a clean working directory):
git checkout <something>
touch *
git add -A . (will add nothing)
git commit (nothing to commit)
Previously this would break for any text file containing a CR.
Some of you may have been folowing Eyvind's excellent thread about
trying to make end-of-line translation in git a bit smoother.
I decided to attack the problem from a different angle: Is it possible
to make autocrlf behave non-destructively for all the previous problem cases?
Stealing the problem from Eyvind's initial mail (paraphrased and
summarized a bit):
1. Setting autocrlf globally is a pain since autocrlf does not work well
with CRLF in the repo
2. Setting it in individual repos is hard since you do it "too late"
(the clone will get it wrong)
3. If someone checks in a file with CRLF later, you get into problems again
4. If a repository once has contained CRLF, you can't tell autocrlf
at which commit everything is sane again
5. autocrlf does needless work if you know that all your users want
the same EOL style.
I belive that this patch makes autocrlf a safe (and good) default
setting for Windows, and this solves problems 1-4 (it solves 2 by being
set by default, which is early enough for clone).
I implemented it by looking for CR charactes in the index, and
aborting any conversion attempt if this is found.
Signed-off-by: Finn Arne Gangstad <finag@pvv.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
After 9c00de5 (ls-remote: fall-back to default remotes when no remote
specified), when no repository is specified, ls-remote may use
the URL/remote in the config "branch.<name>.remote" or the remote
"origin"; it may not be immediately obvious to the user which was used.
In such cases, print a simple "From <URL>" line to indicate which
repository was used. This message is similar to git-fetch's, and is
printed to stderr to avoid breaking existing scripts that depend on
ls-remote's output behaviour.
It can also be disabled with -q/--quiet.
Modify tests related to falling back on default remotes to check for
this as well, and add a test to check for suppression of the message.
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
When the user specifies a message, use fmt_merge_msg_shortlog() to
append the shortlog.
Previously, when a message was specified, we ignored the merge title
("Merge <foo> into <bar>") and shortlog from fmt_merge_msg().
Update the documentation for -m to reflect this too.
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
If we know we are creating a bare repository, we use setenv
to set the GIT_DIR directory to the current directory
(either where we already were, or one we created and chdir'd
into with "git init --bare <dir>").
However, with "git --bare init <dir>" (note the --bare as a
git wrapper option), the setup code actually sets GIT_DIR
for us, but it uses the wrong, original cwd when a directory
is given. Because our setenv does not use the overwrite
flag, it is ignored.
We need to set the overwrite flag, but only when we are
given a directory on the command line. That still allows:
GIT_DIR=foo.git git init --bare
to work. The behavior is changed for:
GIT_DIR=foo.git git init --bare bar.git
which used to create the repository in foo.git, but now will
use bar.git. This is more sane, as command line options
should generally override the environment.
Noticed by Oliver Hoffmann.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-check-ref-format(1) describes names which
cannot be used as refnames for git. Some are
legal branchnames in subversion however.
Mangle the not yet handled cases.
Signed-off-by: Torsten Schmutzler <git-ts@theblacksun.eu>
Acked-by: Eric Wong <normalperson@yhbt.net>
* rc/maint-curl-helper:
remote-curl: ensure that URLs have a trailing slash
http: make end_url_with_slash() public
t5541-http-push: add test for URLs with trailing slash
Conflicts:
remote-curl.c
* hg/maint-attr-fix:
attr: Expand macros immediately when encountered.
attr: Allow multiple changes to an attribute on the same line.
attr: Fixed debug output for macro expansion.
* mh/status-optionally-refresh:
t7508: add a test for "git status" in a read-only repository
git status: refresh the index if possible
t7508: add test for "git status" refreshing the index
* cw/ws-indent-with-tab:
whitespace: tests for git-apply --whitespace=fix with tab-in-indent
whitespace: add tab-in-indent support for --whitespace=fix
whitespace: replumb ws_fix_copy to take a strbuf *dst instead of char *dst
whitespace: tests for git-diff --check with tab-in-indent error class
whitespace: add tab-in-indent error class
whitespace: we cannot "catch all errors known to git" anymore
* jk/cached-textconv:
diff: avoid useless filespec population
diff: cache textconv output
textconv: refactor calls to run_textconv
introduce notes-cache interface
make commit_tree a library function
* pc/remove-warn:
Remove a redundant errno test in a usage of remove_path
Introduce remove_or_warn function
Implement the rmdir_or_warn function
Generalise the unlink_or_warn function
stripspace/text-based formatting kicks in when specifying the notes
content with -m or -F, or when an editor is used to edit the notes.
To binary-safely create notes from files, the following construct is
required:
git notes add -C $(git hash-object -w <file>) <object>
Explain this trick (thanks, Johan!) in the manual. Add an ordinary
example, too, to keep this esoteric one company.
Cc: Johan Herland <johan@herland.net>
Cc: Thomas Rast <trast@student.ethz.ch>
Cc: Jeff King <peff@peff.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Previously the test would print to stdout which interfered with the
TAP output. Now this scaffolding code is just a normal test.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
The naming of this test library conflicted with the recommendation in
t/README's "Naming Tests" section.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10eb0007 (request-pull: avoid mentioning that the start point is a
single commit, 2010-01-29), changed the pull request format, so the
test needs some changes to still pass:
- tolerate a missing blank line between “in the git repository at:”
and the name of repository and branch
- recognize subject and date in the new request format
- update the expected request template to match the new format
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Acked-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
At least /bin/sh on FreeBSD 8 interprets backslash followed by newline in an
unquoted here text as "empty".
Signed-off-by: Junio C Hamano <gitster@pobox.com>
'git log --follow <path>' don't track copies from unmodified
files, and this patch fix it.
Signed-off-by: Bo Yang <struggleyb.nku@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>