Some platforms like to stick extra whitespace in the output
of "wc -c"; using the result without quotes gets the shell
to collapse the whitespace.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This allows a common calling sequence
strbuf_branchname(&ref, name);
strbuf_splice(&ref, 0, 0, "refs/heads/", 11);
if (check_ref_format(ref.buf))
die(...);
to be refactored into
if (strbuf_check_branch_ref(&ref, name))
die(...);
Signed-off-by: Junio C Hamano <gitster@pobox.com>
The command is supposed to rename the branch we were on before switched
from to a new name, but was not aware of the short-hand notation we added
recently.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
The command may not be the best place to add this new feature, but
$ git check-ref-format --branch "@{-1}"
allows Porcelains to figure out what branch you were on before the last
branch switching.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
The function takes a user-supplied string that is supposed to be a branch
name, and puts it in a strbuf after expanding possible shorthand notation.
A handful of open coded sequence to do this in the existing code have been
changed to use this helper function.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
These allow you to say "git checkout @{-2}" to switch to the branch two
"branch switching" ago by pretending as if you typed the name of that
branch. As it is likely that we will be introducing more short-hands to
write the name of a branch without writing it explicitly, rename the
functions from "nth_last_branch" to more generic "branch_name", to prepare
for different semantics.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
For example:
git format-patch --numbered-files --stdout --attach HEAD~~
will create two messages with files 1 and 2 attached respectively.
There is no effect when using --numbered-files and --stdout together
without an --attach or --inline, the --numbered-files option will be
ignored. Add a test to show this.
Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Currently when format-patch is used with --attach or --inline the patch
attachment has the SHA1 of the commit for its filename. This replaces
the SHA1 with the filename used by format-patch when outputting to
files.
Fix tests relying on the SHA1 output and add a test showing how the
--suffix option affects the attachment filename output.
Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
We use the commit to generate the patch filename in reopen_stdout()
before we redirect stdout. The cover letter codepath creates a dummy
commit with the desired subject line 'cover letter'.
Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
reopen_stdout() usually takes the oneline subject of a commit,
appends the patch suffix, prepends the output directory (if any) and
then reopens stdout as the resulting file. Now the patch filename (the
oneline subject and the patch suffix) is created in
get_patch_filename() and passed to reopen_stdout() which prepends the
output directory and reopens stdout as that file.
The original function to get the oneline description,
get_oneline_for_filename(), has been renamed to get_patch_filename() to
reflect its new functionality.
Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This specifier represents the sanitized and filename friendly subject
line of a commit. No checks are made against the length of the string,
so users may need to trim the result to the desired length if using as a
filename. This is commonly used by format-patch to massage commit
subjects into filenames and output patches to files.
Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit also converts all reference specifications to a monospaced font,
as the embedded ~ character used in some of the references sometimes causes
the text up to the next ~ to be displayed incorrectly as a subscript when the
HTML pages are generated. This was tested with asciidoc 8.2.5.
Signed-off-by: David J. Mellor <dmellor@whistlingcat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
The --staged option (synonym for --cached) isn't listed in the
completion choices for git diff. This tiny patch adds it.
Trivially-Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Otherwise, it is hard to guess why the fetch failed.
Make sure we at least mention that the repository must be bare.
Also the current branch is printed.
Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
When the index says that the file in the work tree that corresponds to the
blob object that is used for comparison is known to be unchanged, "diff"
reads from the file and applies convert_to_git(), instead of inflating the
object, to feed the internal diff engine with, because an earlier
benchnark found that it tends to be faster to use this optimization.
However, the index can lie when the path is marked as assume-unchanged.
Disable the optimization for such paths.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
When preparing temporary files for an external diff or textconv, it is
easier on the external tools, especially when they are implemented using
platform tools, if they are fed the input after convert_to_working_tree().
This fixes msysGit issue 177.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
The documentation of the post-checkout hook just talks
about git-checkout. But recently git-clone was changed to
call it too, unless the -no-checkout (-n) option is used.
Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
The 'Everyday GIT' guide was using the old dashed form
of git-init.
Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
The data structure used to store this list is a string_list
of sources with the destination in the util member. The
current code just sorts on the source; if a single source is
pushed to two different destination refs at a remote, then
the order in which they are printed is non-deterministic.
This patch implements a comparison using both fields.
Besides being a little nicer on the eyes, giving a stable
sort prevents false negatives in the test suite when
comparing output.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
The test opens fd 3 and instructs git-upload-pack (via GIT_DEBUG_SEND_PACK)
to log information to that channel.
The way in which new processes are spawned by git on MinGW does not inherit
all file descriptors to the child processes, but only 0, 1, and 2.
The tests in t5503 require that file descriptor 3 is inherited from
git-fetch to git-upload-pack.
A complete implementation is non-trivial and not warranted just to satisfy
this test. Note that the incompleteness applies only to the executables
that use compat/mingw.c; bash and perl (the other important executables
used by git) are complete, of course.
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
The tests are skipped if no gpg was found or if gpg is version 1.0.6.
Previously, the latter condition was checked a bit later in the test file
so that the tag verification tests would be exercised. These are now
skipped as well, but only because we would need a facility to revoke a
test prerequisite, which we do not have.
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
The test verifies that glob special characters can be escaped with
backslashes. In particular, the string fo\[ou\]bar is given to git.
On Windows, this does not work because backslashes are first of all
directory separators, and first thing git does with a pathspec from the
command line is to convert backslashes to forward slashes.
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Since the MSYS bash mangles absolute paths that it passes as command line
arguments to non-MSYS progams (such as git or test-path-utils), we have to
bend over backwards to squeeze some usefulness out of the existing tests.
In particular, a set of path normalization tests is added that test
relative paths. Some paths in the ancestor path tests are adjusted to help
MSYS bash's path mangling heuristics.
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Many tests depend on that symbolic links work. This introduces a check
that sets the prerequisite tag SYMLINKS if the file system supports
symbolic links. Since so many tests have to check for this prerequisite,
we do the check in test-lib.sh, so that we don't need to repeat the test
in many scripts.
To check for 'ln -s' failures, you can use a FAT partition on Linux:
$ mkdosfs -C git-on-fat 1000000
$ sudo mount -o loop,uid=j6t,gid=users,shortname=winnt git-on-fat /mnt
Clone git to /mnt and
$ GIT_SKIP_TESTS='t0001.1[34] t0010 t1301 t403[34] t4129.[47] t5701.7
t7701.3 t9100 t9101.26 t9119 t9124.[67] t9200.10 t9600.6' \
make test
(These additionally skipped tests depend on POSIX permissions that FAT on
Linux does not provide.)
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
The effects of this patch can be tested on Linux by commenting out
#define _FILE_OFFSET_BITS 64
in git-compat-util.h.
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
There are two prerequisites:
- The filesystem supports names with tabs or new-lines.
- Files cannot be removed if their containing directory is read-only.
Previously, whether these preconditions are satisified was tested inside
test_expect_success. We move these tests outside because, strictly
speaking, they are not part of the tests.
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
* dm/maint-docco:
Documentation: reword example text in git-bisect.txt.
Documentation: reworded the "Description" section of git-bisect.txt.
Documentation: minor grammatical fixes in git-branch.txt.
Documentation: minor grammatical fixes in git-blame.txt.
Documentation: reword the "Description" section of git-bisect.txt.
Documentation: minor grammatical fixes in git-archive.txt.
The code will end up calling lstat() to check whether the
file still exists; obviously this doesn't work if we're not
in the worktree.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
When --pickaxe-regex is used, forward past the end of matches instead of
advancing to the byte after their start. This way matches count only
once, even if the regular expression matches their tail -- like in the
fixed-string fork of the code.
E.g.: /.*/ used to count the number of bytes instead of the number of
lines. /aa/ resulted in a count of two in "aaa" instead of one.
Also document the fact that regexec() needs a NUL-terminated string as
its second argument by adding an assert().
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
* mg/maint-submodule-normalize-path:
git submodule: Fix adding of submodules at paths with ./, .. and //
git submodule: Add test cases for git submodule add