Jeff King [Thu, 24 May 2012 23:32:52 +0000 (19:32 -0400)]
format-patch: do not use bogus email addresses in message ids
We can ask git_committer_info to be strict about coming up
with an email, which will die automatically on a poorly
configured machine. This is better than letting invalid
message-ids into the wild.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Thu, 24 May 2012 23:32:37 +0000 (19:32 -0400)]
ident: reject bogus email addresses with IDENT_STRICT
If we come up with a hostname like "foo.(none)" because the
user's machine is not fully qualified, we should reject this
in strict mode (e.g., when we are making a commit object),
just as we reject an empty gecos username.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Thu, 24 May 2012 23:28:40 +0000 (19:28 -0400)]
ident: rename IDENT_ERROR_ON_NO_NAME to IDENT_STRICT
Callers who ask for ERROR_ON_NO_NAME are not so much
concerned that the name will be blank (because, after all,
we will fall back to using the username), but rather it is a
check to make sure that low-quality identities do not end up
in things like commit messages or emails (whereas it is OK
for them to end up in things like reflogs).
When future commits add more quality checks on the identity,
each of these callers would want to use those checks, too.
Rather than modify each of them later to add a new flag,
let's refactor the flag.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Thu, 24 May 2012 23:28:25 +0000 (19:28 -0400)]
format-patch: use GIT_COMMITTER_EMAIL in message ids
Before commit
43ae9f4, we generated the tail of a message id
by calling git_committer_info and parsing the email out of
the result.
43ae9f4 changed to use ident_default_email
directly, so we didn't have to bother with parsing. As a
side effect, it meant we no longer used GIT_COMMITTER_EMAIL
at all.
In general, this is probably reasonable behavior. Either the
default email is sane on your system, or you are using
user.email to provide something sane. The exception is if
you rely on GIT_COMMITTER_EMAIL being set all the time to
override the bogus generated email.
This is unlikely to match anybody's real-life setup, but we
do use it in the test environment. And furthermore, it's
what we have always done, and the change in
43ae9f4 was
about cleaning up, not fixing any bug; we should be
conservative and keep the behavior identical.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Thu, 24 May 2012 23:27:24 +0000 (19:27 -0400)]
ident: let callers omit name with fmt_indent
Most callers want to see all of "$name <$email> $date", but
a few want only limited parts, omitting the date, or even
the name. We already have IDENT_NO_DATE to handle the date
part, but there's not a good option for getting just the
email. Callers have to done one of:
1. Call ident_default_email; this does not respect
environment variables, nor does it promise to trim
whitespace or other crud from the result.
2. Call git_{committer,author}_info; this returns the name
and email, leaving the caller to parse out the wanted
bits.
This patch adds IDENT_NO_NAME; it stops short of adding
IDENT_NO_EMAIL, as no callers want it (nor are likely to),
and it complicates the error handling of the function.
When no name is requested, the angle brackets (<>) around
the email address are also omitted.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Thu, 24 May 2012 23:26:50 +0000 (19:26 -0400)]
ident: refactor NO_DATE flag in fmt_ident
As a short-hand, we extract this flag into the local
variable "name_addr_only". It's more accurate to simply
negate this and refer to it as "want_date", which will be
less confusing when we add more NO_* flags.
While we're touching this part of the code, let's move the
call to ident_default_date() only when we are actually going
to use it, not when we have NO_DATE set, or when we get a
date from the environment.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Thu, 24 May 2012 23:26:32 +0000 (19:26 -0400)]
ident: reword empty ident error message
There's on point in printing the name, since it is by
definition the empty string if we have reached this code
path. Instead, let's be more clear that we are complaining
about the empty name, but still show the email address that
it is attached to (since that may provide some context to
the user).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Mon, 21 May 2012 23:10:32 +0000 (19:10 -0400)]
format-patch: refactor get_patch_filename
The get_patch_filename function expects a commit argument
and uses it to get the sanitized subject line when making a
patch filename. However, we also want to use this same
function for the cover letter, which does not have a commit
object. The current solution is to create a fake commit with
the subject "cover letter". Instead, let's make the
get_patch_filename interface more flexibile, and allow
passing a direct subject.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Mon, 21 May 2012 23:10:29 +0000 (19:10 -0400)]
ident: trim whitespace from default name/email
Usually these values get fed to fmt_ident, which will trim
any cruft anyway, but there are a few code paths which use
them directly. Let's clean them up for the benefit of those
callers. Furthermore, fmt_ident will look at the pre-trimmed
value and decide whether to invoke ERROR_ON_NO_NAME; this
check can be fooled by a name consisting only of spaces.
Note that we only bother to clean up when we are pulling the
information from gecos or from system files. Any other value
comes from a config file, where we will have cleaned up
accidental whitespace already.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Mon, 21 May 2012 23:10:26 +0000 (19:10 -0400)]
ident: use a dynamic strbuf in fmt_ident
Now that we accept arbitrary-sized names and email
addresses, the only remaining limit is in the actual
formatting of the names into a buffer. The current limit is
1000 characters, which is not likely to be reached, but
using a strbuf is one less error condition we have to worry
about.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Mon, 21 May 2012 23:10:23 +0000 (19:10 -0400)]
ident: use full dns names to generate email addresses
When we construct an email address from the username and
hostname, we generate the host part of the email with this
procedure:
1. add the result of gethostname
2. if it has a dot, ok, it's fully qualified
3. if not, then look up the unqualified hostname via
gethostbyname; take the domain name of the result and
append it to the hostname
Step 3 can actually produce a bogus result, as the name
returned by gethostbyname may not be related to the hostname
we fed it (e.g., consider a machine "foo" with names
"foo.one.example.com" and "bar.two.example.com"; we may have
the latter returned and generate the bogus name
"foo.two.example.com").
This patch simply uses the full hostname returned by
gethostbyname. In the common case that the first part is the
same as the unqualified hostname, the behavior is identical.
And in the case that it is not the same, we are much more
likely to be generating a valid name.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Mon, 21 May 2012 23:10:20 +0000 (19:10 -0400)]
ident: report passwd errors with a more friendly message
When getpwuid fails, we give a cute but cryptic message.
While it makes sense if you know that getpwuid or identity
functions are being called, this code is triggered behind
the scenes by quite a few git commands these days (e.g.,
receive-pack on a remote server might use it for a reflog;
the current message is hard to distinguish from an
authentication error). Let's switch to something that gives
a little more context.
While we're at it, we can factor out all of the
cut-and-pastes of the "you don't exist" message into a
wrapper function. Rather than provide xgetpwuid, let's make
it even more specific to just getting the passwd entry for
the current uid. That's the only way we use getpwuid anyway,
and it lets us make an even more specific error message.
The current message also fails to mention errno. While the
usual cause for getpwuid failing is that the user does not
exist, mentioning errno makes it easier to diagnose these
problems. Note that POSIX specifies that errno remain
untouched if the passwd entry does not exist (but will be
set on actual errors), whereas some systems will return
ENOENT or similar for a missing entry. We handle both cases
in our wrapper.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Mon, 21 May 2012 23:10:17 +0000 (19:10 -0400)]
drop length limitations on gecos-derived names and emails
When we pull the user's name from the GECOS field of the
passwd file (or generate an email address based on their
username and hostname), we put the result into a
static buffer. While it's extremely unlikely that anybody
ever hit these limits (after all, in such a case their
parents must have hated them), we still had to deal with the
error cases in our code.
Converting these static buffers to strbufs lets us simplify
the code and drop some error messages from the documentation
that have confused some users.
The conversion is mostly mechanical: replace string copies
with strbuf equivalents, and access the strbuf.buf directly.
There are a few exceptions:
- copy_gecos and copy_email are the big winners in code
reduction (since they no longer have to manage the
string length manually)
- git_ident_config wants to replace old versions of
the default name (e.g., if we read the config multiple
times), so it must reset+add to the strbuf instead of
just adding
Note that there is still one length limitation: the
gethostname interface requires us to provide a static
buffer, so we arbitrarily choose 1024 bytes for the
hostname.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Mon, 21 May 2012 23:10:14 +0000 (19:10 -0400)]
ident: don't write fallback username into git_default_name
The fmt_ident function gets a flag that tells us whether to
die if the name field is blank. If it is blank and we don't
die, then we fall back to the username from the passwd file.
The current code writes the value into git_default_name.
However, that's not necessarily correct, as the empty value
might have come from git_default_name, or it might have been
passed in. This leads to two potential problems:
1. If we are overriding an empty name in the passed-in
value, then we may be overwriting a perfectly good name
(from gitconfig or gecos) in the git_default_name
buffer. Later calls to fmt_ident will end up using the
fallback name, even though a better name was available.
2. If we override an empty gecos name, we end up with the
fallback name in git_default_name. A later call that
uses IDENT_ERROR_ON_NO_NAME will see the fallback name
and think that it is a good name, instead of producing
an error. In other words, a blank gecos name would
cause an error with this code:
git_committer_info(IDENT_ERROR_ON_NO_NAME);
but not this:
git_committer_info(0);
git_committer_info(IDENT_ERROR_ON_NO_NAME);
because in the latter case, the first call has polluted
the name buffer.
Instead, let's make the fallback a per-invocation variable.
We can just use the pw->pw_name string directly, since it
only needs to persist through the rest of the function (and
we don't do any other getpwent calls).
Note that while this solves (1) for future invocations of
fmt_indent, the current invocation might use the fallback
when it could in theory load a better value from
git_default_name. However, by not passing
IDENT_ERROR_ON_NO_NAME, the caller is indicating that it
does not care too much about the name, anyway, so we don't
bother; this is primarily about protecting future callers
who do care.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Mon, 21 May 2012 23:10:11 +0000 (19:10 -0400)]
fmt_ident: drop IDENT_WARN_ON_NO_NAME code
There are no more callers who want this, so we can drop it.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Mon, 21 May 2012 23:10:08 +0000 (19:10 -0400)]
format-patch: use default email for generating message ids
We try to generate a sane message id for cover letters and
threading by appending some changing bits to the front of
the user's email address. The current code parses the email
out of the results of git_committer_info, but we can do this
much more easily by just calling ident_default_email
ourselves.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Mon, 21 May 2012 23:10:02 +0000 (19:10 -0400)]
ident: trim trailing newline from /etc/mailname
We use fgets to read the /etc/mailname file, which means we
will typically end up with an extra newline in our
git_default_email. Most of the time this doesn't matter, as
fmt_ident will skip it as cruft, but there is one code path
that accesses it directly (in http-push.c:lock_remote).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Mon, 21 May 2012 23:09:57 +0000 (19:09 -0400)]
move git_default_* variables to ident.c
There's no reason anybody outside of ident.c should access
these directly (they should use the new accessors which make
sure the variables are initialized), so we can make them
file-scope statics.
While we're at it, move user_ident_explicitly_given into
ident.c; while still globally visible, it makes more sense
to reside with the ident code.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Mon, 21 May 2012 23:09:54 +0000 (19:09 -0400)]
move identity config parsing to ident.c
There's no reason for this to be in config, except that once
upon a time all of the config parsing was there. It makes
more sense to keep the ident code together.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Mon, 21 May 2012 23:09:51 +0000 (19:09 -0400)]
fmt-merge-msg: don't use static buffer in record_person
The record_person function just parses out the "name" field
of the person line in a commit and adds it to a string_list.
The only reason we need an extra buffer is that the
string_list functions require a NUL-terminated string.
Instead of the static buffer, we can just allocate a
temporary NUL-terminated copy. In addition to removing a
useless limit, this removes the only user of MAX_GITNAME
outside of ident.c.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Mon, 21 May 2012 23:09:47 +0000 (19:09 -0400)]
http-push: do not access git_default_email directly
By calling the ident_default_email accessor, we can be sure
that the default value is actually filled-in.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Mon, 21 May 2012 23:09:43 +0000 (19:09 -0400)]
ident: split setup_ident into separate functions
This function sets up the default name, email, and date, and
is not publicly available. Let's split it into three public
functions so that callers can get just the parts they need.
While we're at it, let's change the interface to simple
accessors. The original function was called only by fmt_ident,
and contained logic for "if we already have some other
value, don't load the default" which properly belongs in
fmt_ident.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Fri, 11 May 2012 18:40:43 +0000 (11:40 -0700)]
Update draft release notes to 1.7.11 (11th batch)
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Fri, 11 May 2012 18:34:16 +0000 (11:34 -0700)]
Merge branch 'ef/checkout-empty'
Running "git checkout" on an unborn branch used to corrupt HEAD
(regression in 1.7.10); this makes it error out.
By Erik Faye-Lund
* ef/checkout-empty:
checkout: do not corrupt HEAD on empty repo
Junio C Hamano [Fri, 11 May 2012 18:30:07 +0000 (11:30 -0700)]
Merge branch 'jk/maint-reflog-walk-count-vs-time'
Gives a better DWIM behaviour for --pretty=format:%gd, "stash list", and
"log -g", depending on how the starting point ("master" vs "master@{0}" vs
"master@{now}") and date formatting options (e.g. "--date=iso") are given
on the command line.
By Jeff King (4) and Junio C Hamano (1)
* jk/maint-reflog-walk-count-vs-time:
reflog-walk: tell explicit --date=default from not having --date at all
reflog-walk: always make HEAD@{0} show indexed selectors
reflog-walk: clean up "flag" field of commit_reflog struct
log: respect date_mode_explicit with --format:%gd
t1411: add more selector index/date tests
Junio C Hamano [Fri, 11 May 2012 18:29:45 +0000 (11:29 -0700)]
Merge branch 'nd/i18n-branch-lego'
Fix yet another message construction by concatenating pieces of sentenes,
which is unfriendly to i18n.
By Nguyễn Thái Ngọc Duy
* nd/i18n-branch-lego:
branch: remove lego in i18n tracking info strings
Junio C Hamano [Fri, 11 May 2012 18:29:02 +0000 (11:29 -0700)]
Sync with 1.7.10.2
Junio C Hamano [Fri, 11 May 2012 18:25:28 +0000 (11:25 -0700)]
Git 1.7.10.2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Fri, 11 May 2012 18:19:27 +0000 (11:19 -0700)]
Merge branch 'jc/diff-algo-cleanup' into maint
* jc/diff-algo-cleanup:
xdiff: PATIENCE/HISTOGRAM are not independent option bits
xdiff: remove XDL_PATCH_* macros
Junio C Hamano [Fri, 11 May 2012 18:18:43 +0000 (11:18 -0700)]
Merge branch 'ct/advise-push-default' into maint
The cases "git push" fails due to non-ff can be broken into three
categories; each case is given a separate advise message.
By Christopher Tiwald (2) and Jeff King (1)
* ct/advise-push-default:
Fix httpd tests that broke when non-ff push advice changed
clean up struct ref's nonfastforward field
push: Provide situational hints for non-fast-forward errors
Junio C Hamano [Fri, 11 May 2012 18:17:49 +0000 (11:17 -0700)]
Merge branch 'js/fast-import-test-9300' into maint
By Johannes Sixt
* js/fast-import-test-9300:
t9300-fast-import: avoid 'exit' in test_expect_success snippets
Junio C Hamano [Fri, 11 May 2012 18:16:45 +0000 (11:16 -0700)]
Merge branch 'jk/repack-no-explode-objects-from-old-pack' into maint
"git repack" used to write out unreachable objects as loose objects
when repacking, even if such loose objects will immediately pruned
due to its age.
By Jeff King
* jk/repack-no-explode-objects-from-old-pack:
gc: use argv-array for sub-commands
argv-array: add a new "pushl" method
argv-array: refactor empty_argv initialization
gc: do not explode objects which will be immediately pruned
Junio C Hamano [Fri, 11 May 2012 18:16:09 +0000 (11:16 -0700)]
Merge branch 'ah/maint-grep-double-init' into maint
By Angus Hammond
* ah/maint-grep-double-init:
grep.c: remove redundant line of code
Junio C Hamano [Fri, 11 May 2012 18:15:53 +0000 (11:15 -0700)]
Merge branch 'fa/maint-config-doc' into maint
By Florian Achleitner
* fa/maint-config-doc:
Documentation/git-config: describe and clarify "--local <file>" option
Junio C Hamano [Fri, 11 May 2012 18:15:10 +0000 (11:15 -0700)]
Merge branch 'rs/unpack-trees-leakfix' into maint
By René Scharfe
* rs/unpack-trees-leakfix:
unpack-trees: plug minor memory leak
unpack-trees: don't perform any index operation if we're not merging
Junio C Hamano [Fri, 11 May 2012 18:14:57 +0000 (11:14 -0700)]
Merge branch 'sl/test-wc-l-line-count' into maint
By Stefano Lattarini
* sl/test-wc-l-line-count:
tests: modernise style: more uses of test_line_count
Junio C Hamano [Fri, 11 May 2012 18:13:26 +0000 (11:13 -0700)]
Merge branch 'rl/show-empty-prefix' into maint
Unlike "git rev-parse --show-cdup", "--show-prefix" did not give an
empty line when run at the top of the working tree.
By Ross Lagerwall
* rl/show-empty-prefix:
rev-parse --show-prefix: add in trailing newline
Heiko Voigt [Thu, 10 May 2012 18:59:04 +0000 (20:59 +0200)]
document submdule.$name.update=none option for gitmodules
This option was not yet described in the gitmodules documentation. We
only described it in the 'git submodule' command documentation but
gitmodules is the more natural place to look.
A short reference in the 'git submodule' documentation should be
sufficient since the details can now be found in the documentation to
gitmodules.
Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Thu, 10 May 2012 18:04:31 +0000 (11:04 -0700)]
The tenth batch of topics
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Thu, 10 May 2012 17:49:55 +0000 (10:49 -0700)]
Merge branch 'rs/dir-strbuf'
By René Scharfe
* rs/dir-strbuf:
dir: convert to strbuf
Junio C Hamano [Thu, 10 May 2012 17:49:52 +0000 (10:49 -0700)]
Merge branch 'nd/i18n-apply-lego'
By Nguyễn Thái Ngọc Duy
* nd/i18n-apply-lego:
apply: remove lego in i18n string in gitdiff_verify_name
Junio C Hamano [Thu, 10 May 2012 17:49:46 +0000 (10:49 -0700)]
Merge branch 'jk/status-porcelain-z-b'
"git status --porcelain" ignored "--branch" option by mistake. The output
for "git status --branch -z" was also incorrect and did not terminate the
record for the current branch name with NUL as asked.
By Jeff King
via Jeff King
* jk/status-porcelain-z-b:
status: refactor colopts handling
status: respect "-b" for porcelain format
status: fix null termination with "-b"
status: refactor null_termination option
commit: refactor option parsing
Junio C Hamano [Thu, 10 May 2012 17:49:42 +0000 (10:49 -0700)]
Merge branch 'fa/maint-config-doc'
By Florian Achleitner
* fa/maint-config-doc:
Documentation/git-config: describe and clarify "--local <file>" option
Junio C Hamano [Thu, 10 May 2012 17:49:35 +0000 (10:49 -0700)]
Merge branch 'ef/maint-clone-progress-fix'
Some time ago, "git clone" lost the progress output for its "checkout"
phase; when run without any "--quiet" option, it should give progress to
the lengthy operation.
By Erik Faye-Lund
* ef/maint-clone-progress-fix:
clone: fix progress-regression
Junio C Hamano [Thu, 10 May 2012 17:49:31 +0000 (10:49 -0700)]
Merge branch 'ah/maint-grep-double-init'
By Angus Hammond
* ah/maint-grep-double-init:
grep.c: remove redundant line of code
Junio C Hamano [Thu, 10 May 2012 17:49:25 +0000 (10:49 -0700)]
Merge branch 'js/checkout-detach-count'
When checking out another commit from an already detached state, we used
to report all commits that are not reachable from any of the refs as
lossage, but some of them might be reachable from the new HEAD, and there
is no need to warn about them.
By Johannes Sixt
* js/checkout-detach-count:
checkout (detached): truncate list of orphaned commits at the new HEAD
t2020-checkout-detach: check for the number of orphaned commits
Junio C Hamano [Thu, 10 May 2012 17:49:18 +0000 (10:49 -0700)]
Merge branch 'jc/install-no-hardlinks'
Your build platform may support hardlinks but you may prefer not to use
them, e.g. when installing to DESTDIR to make a tarball and untarring on
a filesystem that has poor support for hardlinks.
The Makefile in git-gui project may need to learn to honor the same
setting; it unconditionally creates git-citool by hardlinking git-gui.
* jc/install-no-hardlinks:
Makefile: NO_INSTALL_HARDLINKS
Junio C Hamano [Thu, 10 May 2012 17:49:13 +0000 (10:49 -0700)]
Merge branch 'nd/stream-to-archive'
Stream large blobs directly out to archive files without slurping
everything in memory first.
By René Scharfe (6) and Nguyễn Thái Ngọc Duy (4)
* nd/stream-to-archive:
t5000: rationalize unzip tests
archive-zip: streaming for deflated files
archive-zip: streaming for stored files
archive-zip: factor out helpers for writing sizes and CRC
archive-zip: remove uncompressed_size
archive-tar: stream large blobs to tar file
archive: delegate blob reading to backend
archive-tar: unindent write_tar_entry by one level
archive-tar: turn write_tar_entry into blob-writing only
streaming: void pointer instead of char pointer
Junio C Hamano [Thu, 10 May 2012 17:49:07 +0000 (10:49 -0700)]
Merge branch 'mh/ref-api-lazy-loose'
Refs API is updated to lazily read sub-hierarchies of refs/ namespace,
so that we do not have to grab everything from the filesystem when we
are only interested in listing branches, for example.
By Michael Haggerty (17) and Junio C Hamano (1)
* mh/ref-api-lazy-loose:
refs: fix find_containing_dir() regression
refs: read loose references lazily
read_loose_refs(): eliminate ref_cache argument
struct ref_dir: store a reference to the enclosing ref_cache
search_for_subdir(): return (ref_dir *) instead of (ref_entry *)
get_ref_dir(): add function for getting a ref_dir from a ref_entry
read_loose_refs(): rename function from get_ref_dir()
refs: wrap top-level ref_dirs in ref_entries
find_containing_dir(): use strbuf in implementation of this function
bisect: copy filename string obtained from git_path()
do_for_each_reflog(): use a strbuf to hold logfile name
do_for_each_reflog(): return early on error
get_ref_dir(): take the containing directory as argument
refs.c: extract function search_for_subdir()
get_ref_dir(): require that the dirname argument ends in '/'
get_ref_dir(): rename "base" parameter to "dirname"
get_ref_dir(): use a strbuf to hold refname
get_ref_dir(): return early if directory cannot be read
Junio C Hamano [Thu, 10 May 2012 17:45:47 +0000 (10:45 -0700)]
Merge branch 'maint'
Junio C Hamano [Thu, 10 May 2012 17:45:42 +0000 (10:45 -0700)]
Update draft release notes to 1.7.10.2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Thu, 10 May 2012 17:33:05 +0000 (10:33 -0700)]
Merge branch 'mm/include-userpath' into maint
By Jeff King
* mm/include-userpath:
config: expand tildes in include.path variable
Junio C Hamano [Thu, 10 May 2012 17:32:43 +0000 (10:32 -0700)]
Merge branch 'cc/fix-missing-va-end-in-revert' into maint
By Christian Couder
* cc/fix-missing-va-end-in-revert:
revert: add missing va_end
Junio C Hamano [Thu, 10 May 2012 17:32:15 +0000 (10:32 -0700)]
Merge branch 'bw/test-fix-grep-gnuism' into maint
* bw/test-fix-grep-gnuism:
t9400: fix gnuism in grep
Junio C Hamano [Thu, 10 May 2012 17:29:50 +0000 (10:29 -0700)]
Merge branch 'jk/http-backend-keep-committer-ident-env' into maint
By Jeff King
* jk/http-backend-keep-committer-ident-env:
http-backend: respect existing GIT_COMMITTER_* variables
Conflicts:
t/t5541-http-push.sh
Junio C Hamano [Thu, 10 May 2012 17:29:14 +0000 (10:29 -0700)]
Merge branch 'nl/rebase-i-cheat-sheet' into maint
* nl/rebase-i-cheat-sheet:
rebase -i: remind that the lines are top-to-bottom
Junio C Hamano [Thu, 10 May 2012 17:27:58 +0000 (10:27 -0700)]
Merge branch 'bw/submodule-sed-solaris' into maint
By Ben Walton
* bw/submodule-sed-solaris:
Avoid bug in Solaris xpg4/sed as used in submodule
Junio C Hamano [Thu, 10 May 2012 17:08:54 +0000 (10:08 -0700)]
Merge branch 'jk/maint-push-progress' into maint
"git push" over smart-http lost progress output a few releases ago.
By Jeff King
* jk/maint-push-progress:
t5541: test more combinations of --progress
teach send-pack about --[no-]progress
send-pack: show progress when isatty(2)
Junio C Hamano [Thu, 10 May 2012 17:08:24 +0000 (10:08 -0700)]
Merge branch 'jc/rerere-train' into maint
A contrib script "rerere-train" did not work out of the box unless user
futzed with her $PATH.
* jc/rerere-train:
contrib/rerere-train: use installed git-sh-setup
Junio C Hamano [Thu, 10 May 2012 17:06:52 +0000 (10:06 -0700)]
Merge branch 'lp/diffstat-with-graph' into maint
"log --graph" was not very friendly with "--stat" option and its output
had line breaks at wrong places.
By Lucian Poston (5) and Zbigniew Jędrzejewski-Szmek (3)
* lp/diffstat-with-graph:
t4052: work around shells unable to set COLUMNS to 1
test-lib: skip test with COLUMNS=1 under mksh
Prevent graph_width of stat width from falling below min
t4052: Test diff-stat output with minimum columns
t4052: Adjust --graph --stat output for prefixes
Adjust stat width calculations to take --graph output into account
Add output_prefix_length to diff_options
t4052: test --stat output with --graph
Erik Faye-Lund [Tue, 8 May 2012 17:22:33 +0000 (19:22 +0200)]
checkout: do not corrupt HEAD on empty repo
In
abe1998 ("git checkout -b: allow switching out of an unborn
branch"), a code-path overly-optimisticly assumed that a
branch-name was specified. This is not always the case, and as
a result a NULL-pointer was attempted printed to .git/HEAD.
This could lead to at least two different failure modes:
1) vsnprintf formated the NULL-string as something useful (e.g
"(null)")
2) vsnprintf crashed
Neither were very convenient for formatting a new HEAD-reference.
To fix this, reintroduce some strictness so we only take this
new codepath if a banch-name was specified.
Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Nguyễn Thái Ngọc Duy [Sun, 6 May 2012 13:13:22 +0000 (20:13 +0700)]
apply: remove lego in i18n string in gitdiff_verify_name
It marks the string "...inconsistent %s filename..." where %s is either
"old" or "new" from caller. Make it two strings "...inconsistent new
filename..." and "...inconsistent old filename...".
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Tue, 8 May 2012 16:43:40 +0000 (09:43 -0700)]
Merge branch 'rs/maint-dir-strbuf' into rs/dir-strbuf
By René Scharfe
* rs/maint-dir-strbuf:
dir: convert to strbuf
René Scharfe [Tue, 1 May 2012 11:25:24 +0000 (13:25 +0200)]
dir: convert to strbuf
The functions read_directory_recursive() and treat_leading_path() both
use buffers sized to fit PATH_MAX characters. The latter can be made to
overrun its buffer, e.g. like this:
$ a=
0123456789abcdef
$ a=$a$a$a$a$a$a$a$a
$ a=$a$a$a$a$a$a$a$a
$ a=$a$a$a$a$a$a$a$a
$ git add $a/a
Instead of trying to add a check and potentionally forgetting to address
similar cases, convert the involved functions and their helpers to use
struct strbuf. The patch is suprisingly large because the helpers
treat_path() and treat_one_path() modify the buffer as well and thus need
to be converted, too.
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Mon, 7 May 2012 19:35:03 +0000 (15:35 -0400)]
status: refactor colopts handling
The current code reads the config and command-line options
into a separate "colopts" variable, and then copies the
contents of that variable into the "struct wt_status". We
can eliminate the extra variable and copy just write
straight into the wt_status struct.
This simplifies the "status" code a little bit.
Unfortunately, it makes the "commit" code one line more
complex; a side effect of the separate variable was that
"commit" did not copy the colopts variable, so any
column.status configuration had no effect.
The result still ends up cleaner, though. In the previous
version, it was unclear whether commit simply forgot to copy
the colopt variable, or whether it was intentional. Now it
explicitly turns off column options. Furthermore, if commit
later learns to respect column.status, this will make the
end result simpler. I punted on just adding that feature
now, because it was sufficiently non-obvious that it should
not go into a refactoring patch.
Signed-off-by: Jeff King <peff@peff.net>
Jeff King [Tue, 8 May 2012 08:55:35 +0000 (04:55 -0400)]
Merge branch 'jk/maint-status-porcelain-z-b' into HEAD
* jk/maint-status-porcelain-z-b:
status: respect "-b" for porcelain format
status: fix null termination with "-b"
status: refactor null_termination option
commit: refactor option parsing
Conflicts:
wt-status.h
Jeff King [Mon, 7 May 2012 21:09:04 +0000 (17:09 -0400)]
status: respect "-b" for porcelain format
There is no reason not to, as the user has to explicitly ask
for it, so we are not breaking compatibility by doing so. We
can do this simply by moving the "show_branch" flag into
the wt_status struct. As a bonus, this saves us from passing
it explicitly, simplifying the code.
Signed-off-by: Jeff King <peff@peff.net>
Jeff King [Mon, 7 May 2012 21:02:18 +0000 (17:02 -0400)]
status: fix null termination with "-b"
When the "-z" option is given to status, we are supposed to
NUL-terminate each record. However, the "-b" code to show
the tracking branch did not respect this, and always ended
with a newline.
Signed-off-by: Jeff King <peff@peff.net>
Jeff King [Mon, 7 May 2012 19:44:44 +0000 (15:44 -0400)]
status: refactor null_termination option
This option is passed separately to the wt_status printing
functions, whereas every other formatting option is
contained in the wt_status struct itself. Let's do the same
here, so we can avoid passing it around through the call
stack.
Signed-off-by: Jeff King <peff@peff.net>
Jeff King [Mon, 7 May 2012 19:18:26 +0000 (15:18 -0400)]
commit: refactor option parsing
The options are declared as a static global, but really they
need only be accessible from cmd_commit. Additionally,
declare the "struct wt_status" in cmd_commit and cmd_status
as static at the top of each function; this will let the
options lists reference them directly, which will facilitate
further cleanups.
Signed-off-by: Jeff King <peff@peff.net>
Florian Achleitner [Sat, 5 May 2012 10:03:52 +0000 (12:03 +0200)]
Documentation/git-config: describe and clarify "--local <file>" option
Describe config file selection in git-config. While the usage message of
git-config shows --local, the documentation page did not contain anything
about that.
Signed-off-by: Florian Achleitner <florian.achleitner.2.6.31@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Mon, 7 May 2012 21:11:32 +0000 (14:11 -0700)]
reflog-walk: tell explicit --date=default from not having --date at all
Introduction of opt->date_mode_explicit was a step in the right direction,
but lost that crucial bit at the very end of the callchain, and the callee
could not tell an explicitly specified "I want *date* but in default format"
from the built-in default value passed when there was no --date specified.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Mon, 7 May 2012 20:39:38 +0000 (13:39 -0700)]
The ninth batch of topics graduated to 'master'
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Mon, 7 May 2012 20:29:16 +0000 (13:29 -0700)]
Merge branch 'nh/empty-rebase'
By Neil Horman
* nh/empty-rebase:
git cherry-pick: do not dereference a potential NULL pointer
Junio C Hamano [Mon, 7 May 2012 20:29:08 +0000 (13:29 -0700)]
Merge branch 'zj/diff-empty-chmod'
"git diff --stat" used to fully count a binary file with modified
execution bits whose contents is unmodified, which was not right.
By Zbigniew Jędrzejewski-Szmek (4) and Johannes Sixt (1)
* zj/diff-empty-chmod:
t4006: Windows do not have /dev/zero
diff --stat: do not run diff on indentical files
diff --stat: report mode-only changes for binary files like text files
tests: check --[short]stat output after chmod
test: modernize style of t4006
Conflicts:
diff.c
Junio C Hamano [Mon, 7 May 2012 20:29:01 +0000 (13:29 -0700)]
Merge branch 'jk/maint-tformat-with-z'
"log -z --pretty=tformat:..." does not terminate each record with NUL
and this is a beginning of an attempt to fix it. It still is not right
but the patch does not make externally observable behaviour worse.
By Jan Krüger (1) and Junio C Hamano (1)
* jk/maint-tformat-with-z:
log-tree: the previous one is still not quite right
log-tree: use custom line terminator in line termination mode
Junio C Hamano [Mon, 7 May 2012 20:28:44 +0000 (13:28 -0700)]
Merge branch 'th/difftool-diffall'
Rolls the two-directory-diff logic from diffall script (in contrib/) into
"git difftool" framework.
By Tim Henigan
* th/difftool-diffall:
difftool: print list of valid tools with '--tool-help'
difftool: teach difftool to handle directory diffs
difftool: eliminate setup_environment function
difftool: stop appending '.exe' to git
difftool: remove explicit change of PATH
difftool: exit(0) when usage is printed
difftool: add '--no-gui' option
difftool: parse options using Getopt::Long
Junio C Hamano [Mon, 7 May 2012 20:28:34 +0000 (13:28 -0700)]
Sync with maint
Junio C Hamano [Mon, 7 May 2012 20:24:13 +0000 (13:24 -0700)]
Start preparing for 1.7.10.2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Mon, 7 May 2012 20:17:31 +0000 (13:17 -0700)]
Merge branch 'jk/maint-gitweb-test-use-sane-perl' into maint
When using a Perl script on a system where "perl" found on user's $PATH
could be ancient or otherwise broken, we allow builders to specify the
path to a good copy of Perl with $PERL_PATH. The gitweb test forgot to
use that Perl when running its test.
By Jeff King (1) and Zbigniew Jędrzejewski-Szmek (1)
* jk/maint-gitweb-test-use-sane-perl:
Consistently use perl from /usr/bin/ for scripts
t/gitweb-lib: use $PERL_PATH to run gitweb
Junio C Hamano [Mon, 7 May 2012 20:17:17 +0000 (13:17 -0700)]
Merge branch 'js/daemon-test-race-fix' into maint
The test scaffolding for git-daemon was flaky.
By Johannes Sixt
* js/daemon-test-race-fix:
t5570: fix forwarding of git-daemon messages via cat
Junio C Hamano [Mon, 7 May 2012 20:14:08 +0000 (13:14 -0700)]
Merge branch 'jk/maint-config-bogus-section' into maint
"git config --rename-section" to rename an existing section into a bogus
one did not check the new name.
By Jeff King
* jk/maint-config-bogus-section:
config: reject bogus section names for --rename-section
Junio C Hamano [Mon, 7 May 2012 20:13:55 +0000 (13:13 -0700)]
Merge branch 'pw/t5800-import-race-fix' into maint
The test scaffolding for fast-import was flaky.
By Pete Wyckoff
* pw/t5800-import-race-fix:
git-remote-testgit: fix race when spawning fast-import
Junio C Hamano [Mon, 7 May 2012 20:13:43 +0000 (13:13 -0700)]
Merge branch 'rt/cherry-revert-conflict-summary' into maint
In the older days, the header "Conflicts:" in "cherry-pick" and "merge"
was separated by a blank line from the list of paths that follow for
readability, but when "merge" was rewritten in C, we lost it by
mistake. Remove the newline from "cherry-pick" to make them match again.
By Ralf Thielow
* rt/cherry-revert-conflict-summary:
sequencer: remove additional blank line
Junio C Hamano [Mon, 7 May 2012 20:13:03 +0000 (13:13 -0700)]
Merge branch 'cb/maint-report-mount-point-correctly-in-setup' into maint
The filesystem boundary was not correctly reported when .git directory
discovery stopped at a mount point.
By Clemens Buchacher
* cb/maint-report-mount-point-correctly-in-setup:
properly keep track of current working directory
Junio C Hamano [Mon, 7 May 2012 19:35:36 +0000 (12:35 -0700)]
Merge branch 'ef/maint-1.7.6-clone-progress-fix' into ef/maint-clone-progress-fix
By Erik Faye-Lund
* ef/maint-1.7.6-clone-progress-fix:
clone: fix progress-regression
Erik Faye-Lund [Mon, 7 May 2012 19:23:13 +0000 (21:23 +0200)]
clone: fix progress-regression
In
5bd631b3 ("clone: support multiple levels of verbosity"), the
default behavior to show progress of the implicit checkout in
the clone-command regressed so that progress was only shown if
the verbose-option was specified.
Fix this by making option_verbosity == 0 output progress as well.
Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Angus Hammond [Sun, 6 May 2012 18:17:15 +0000 (19:17 +0100)]
grep.c: remove redundant line of code
Signed-off-by: Angus Hammond <angusgh@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Pete Wyckoff [Sun, 6 May 2012 15:58:38 +0000 (11:58 -0400)]
git p4 doc: fix formatting
Attach example sections to previous level of indenting.
Fix a trailing ::
Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Johannes Sixt [Fri, 4 May 2012 18:14:48 +0000 (20:14 +0200)]
checkout (detached): truncate list of orphaned commits at the new HEAD
When git checkout switches from a detached HEAD to any other commit, then
all orphaned commits were listed in a warning:
Warning: you are leaving 2 commits behind...:
a5e5396 another fixup
6aa1af6 fixup foo
But if the new commit is actually one from this list (
6aa1af6 in this
example), then the list in the warning can be truncated at the new HEAD,
because history beginning at HEAD is not "left behind". This makes it so.
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Johannes Sixt [Fri, 4 May 2012 18:13:14 +0000 (20:13 +0200)]
t2020-checkout-detach: check for the number of orphaned commits
Change the test that orphans commits to leave 2 commits behind. Add a test
that leaves only one of these behind.
The next patch will truncate the list of orphaned commits earlier. With
this preliminary update, its effect will become more obvious.
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Wed, 2 May 2012 22:12:10 +0000 (15:12 -0700)]
Makefile: NO_INSTALL_HARDLINKS
Your filesystem may support hardlinks, but you may choose not to use them
when installing git-foo builtins and favor symblic links or copies for
whatever reason.
The installation procedure of git-gui/ directory is not touched with this
patch and git-citool still ends up being a hardlink to git-gui, but it
needs to be addressed separately.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Fri, 4 May 2012 05:27:25 +0000 (01:27 -0400)]
reflog-walk: always make HEAD@{0} show indexed selectors
When we are showing reflog selectors during a walk, we infer
from context whether the user wanted to see the index in
each selector, or the reflog date. The current rules are:
1. if the user asked for an explicit date format in the
output, show the date
2. if the user asked for ref@{now}, show the date
3. if neither is true, show the index
However, if we see "ref@{0}", that should be a strong clue
that the user wants to see the counted version. In fact, it
should be much stronger than the date format in (1). The
user may have been setting the date format to use in another
part of the output (e.g., in --format="%gd (%ad)", they may
have wanted to influence the author date).
This patch flips the rules to:
1. if the user asked for ref@{0}, always show the index
2. if the user asked for ref@{now}, always show the date
3. otherwise, we have just "ref"; show them counted by
default, but respect the presence of "--date" as a clue
that the user wanted them date-based
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Fri, 4 May 2012 05:26:26 +0000 (01:26 -0400)]
reflog-walk: clean up "flag" field of commit_reflog struct
When we prepare to walk a reflog, we parse the specification
and pull some information from it, such as which reflog to
look in (e.g., HEAD), and where to start (e.g., HEAD@{10} or
HEAD@{yesterday}). The resulting struct has a "recno" field
to show where in the reflog we are starting. It also has a
"flag" field; if true, it means the recno field came from
parsing a date like HEAD@{yesterday}.
There are two problems with this:
1. "flag" is an absolutely terrible name, as it conveys
nothing about the meaning
2. you can tell "HEAD" from "HEAD@{yesterday}", but you
can't differentiate "HEAD" from "HEAD{0}"
This patch converts the flag into a tri-state (and gives it
a better name!).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Fri, 4 May 2012 05:25:18 +0000 (01:25 -0400)]
log: respect date_mode_explicit with --format:%gd
When we show a reflog selector (e.g., via "git log -g"), we
perform some DWIM magic: while we normally show the entry's
index (e.g., HEAD@{1}), if the user has given us a date
with "--date", then we show a date-based select (e.g.,
HEAD@{yesterday}).
However, we don't want to trigger this magic if the
alternate date format we got was from the "log.date"
configuration; that is not sufficiently strong context for
us to invoke this particular magic. To fix this, commit
f4ea32f (improve reflog date/number heuristic, 2009-09-24)
introduced a "date_mode_explicit" flag in rev_info. This
flag is set only when we see a "--date" option on the
command line, and we a vanilla date to the reflog code if
the date was not explicit.
Later, commit
8f8f547 (Introduce new pretty formats %g[sdD]
for reflog information, 2009-10-19) added another way to
show selectors, and it did not respect the date_mode_explicit
flag from
f4ea32f.
This patch propagates the date_mode_explicit flag to the
pretty-print code, which can then use it to pass the
appropriate date field to the reflog code. This brings the
behavior of "%gd" in line with the other formats, and means
that its output is independent of any user configuration.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Fri, 4 May 2012 05:23:14 +0000 (01:23 -0400)]
t1411: add more selector index/date tests
We already check that @{now} and "--date" cause the
displayed selector to use the date for both the multiline
and oneline formats. However, we miss several cases:
1. The --format=%gd selector is not tested at all.
2. We do not check how the log.date config interacts with the
"--date" magic (according to
f4ea32f, it should not
impact the output).
Doing so reveals that the combination of both (log.date
combined with the %gd format) does not behave as expected.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Nguyễn Thái Ngọc Duy [Fri, 4 May 2012 13:52:36 +0000 (20:52 +0700)]
Makefile: keep many variable list sorted
We tend to keep long lists sorted (extensions are not taken into
account), which helps spot a name easily by eye. Rearrange a few
items so these lists remain sorted.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Thu, 3 May 2012 22:12:54 +0000 (15:12 -0700)]
refs: fix find_containing_dir() regression
The function used to return NULL when asked to find the containing
directory for a ref that does not exist, allowing the caller to
omit iteration altogether. But a misconversion in an earlier change
"refs.c: extract function search_for_subdir()" started returning the
top-level directory entry, forcing callers to walk everything.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Nguyễn Thái Ngọc Duy [Thu, 3 May 2012 13:12:00 +0000 (20:12 +0700)]
branch: remove lego in i18n tracking info strings
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Neil Horman [Thu, 3 May 2012 12:10:22 +0000 (08:10 -0400)]
git cherry-pick: do not dereference a potential NULL pointer
In the case the pointer could be NULL, the function that gave the caller
the NULL pointer would already have issued an error message, so simply
returning early with an error status without issuing a new message is
sufficient. The same for parse_commit() that will show necessary error
message when the argument is not NULL, and will return error silently
when the argument is NULL.
Noticed-by: Michael Mueller
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>