Code

git.git
14 years agogitweb: Make linking to actions requiring JavaScript a feature
Jakub Narebski [Thu, 26 Nov 2009 20:12:15 +0000 (21:12 +0100)]
gitweb: Make linking to actions requiring JavaScript a feature

Let gitweb turn some links (like 'blame' links) into linking to actions
which require JavaScript (like 'blame_incremental' action) only if
'javascript-actions' feature is enabled.

This means that links to such actions would be present only if both
JavaScript is enabled and 'javascript-actions' feature is enabled.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agogitweb.js: fix padLeftStr() and its usage
Stephen Boyd [Wed, 25 Nov 2009 03:51:40 +0000 (19:51 -0800)]
gitweb.js: fix padLeftStr() and its usage

It seems that in Firefox-3.5 inserting &nbsp; with javascript inserts the
literal &nbsp; instead of a space. Fix this by inserting the unicode
representation for &nbsp; instead.

Also fix the off-by-one error in the padding calculation that was
causing one less space to be inserted than was requested by the caller.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Cc: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agogitweb.js: Harden setting blamed commit info in incremental blame
Jakub Narebski [Wed, 25 Nov 2009 00:45:15 +0000 (01:45 +0100)]
gitweb.js: Harden setting blamed commit info in incremental blame

Internet Explorer 8 stops at beginning of blame filling with the
following bug:

  "firstChild is null or not an object"

at this line:

  a_sha1.firstChild.data = commit.sha1.substr(0, 8);

It is (probably) caused by the fact that while a_sha1 element, which
looks like this:

  <a href=""> </a>

It has a firstChild which is a text node containing only whitespace
(single space character) in other web browsers (Firefox 3.5, Opera 10,
Google Chrome 3.0), IE8 clobbers DOM, removing trailing/leading
whitespace.

Protect against this bug by creating text element if it does not
exist.

Found-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agogitweb.js: fix null object exception in initials calculation
Stephen Boyd [Thu, 19 Nov 2009 19:44:46 +0000 (11:44 -0800)]
gitweb.js: fix null object exception in initials calculation

Currently handleLine() assumes that a commit author name will always
start with a capital letter. It's possible that the author name is
user@example.com and therefore calling a match() on the name will fail
to return any matches. Subsequently joining these matches will cause an
exception. Fix by checking that we have a match before trying to join
the results into a set of initials for the author.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Acked-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agogitweb: Minify gitweb.js if JSMIN is defined
Jakub Narebski [Tue, 1 Sep 2009 11:39:20 +0000 (13:39 +0200)]
gitweb: Minify gitweb.js if JSMIN is defined

It requires that $JSMIN command can function as a filter.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agogitweb: Create links leading to 'blame_incremental' using JavaScript
Jakub Narebski [Tue, 1 Sep 2009 11:39:19 +0000 (13:39 +0200)]
gitweb: Create links leading to 'blame_incremental' using JavaScript

The new 'blame_incremental' view requires JavaScript to run.  Not all
web browsers implement JavaScript (e.g. text browsers such as Lynx),
and not all users have JavaScript enabled.  Therefore instead of
unconditionally linking to 'blame_incremental' view, we use JavaScript
to convert those links to lead to view utilizing JavaScript, by adding
'js=1' to link.

Currently the only action that takes 'js=1' into account is 'blame',
which then acts as if it was called as 'blame_incremental' action.
Possible enhancement would be to do JavaScript redirect by setting
window.location instead of modifying $format and $action in
git_blame_common() subroutine.

The only JavaScript-aware/using view is currently 'blame_incremental'.
While at it move reading JavaScript to git_footer_html() subroutine.
Note that in this view we do not add 'js=1' currently (even though
perhaps we should; note that for consistency we should also add 'js=1'
in links added by JavaScript part of 'blame_incremental').

This idea was originally implemented by Petr Baudis in
  http://article.gmane.org/gmane.comp.version-control.git/47614
but it added <script> element with fixBlameLinks() function in page
header, to be added as onload event using 'onload' attribute of HTML
'body' element: <body onload="fixBlameLinks();">.  This version adds
script at then end of page (in the page footer), and uses JavaScript
'window.onload=fixLinks();'.  Also in Petr version only links marked
with 'blamelink' class were modified, and they were modified by
replacing "a=blame" by "a=blame_incremental"... which doesn't work for
path_info links, and might replace wrong part if there is "a=blame" in
project name, ref name or file name.

Slightly different solution was implemented by Martin Koegler in
  http://thread.gmane.org/gmane.comp.version-control.git/47902/focus=47905
Here GitAddLinks() function was in gitweb.js file, not as contents of
<script> element.  It was also included in page header (in <head>
element) though, which means waiting for a script to load (and run).
It was smarter in that to "fix" (modify) link, it split URL, modified
value of 'a' parameter, and then recreated modified link.  It avoids
trouble with "a=blame" as substring in project name or file name, but
it doesn't work with path_info URL/link in the way it was written.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agogitweb: Colorize 'blame_incremental' view during processing
Jakub Narebski [Tue, 1 Sep 2009 11:39:18 +0000 (13:39 +0200)]
gitweb: Colorize 'blame_incremental' view during processing

This requires using 3 colors, not only two, to choose a color that is
different from colors of up to 2 neighbors.

gitweb.js selects the least used color, if more than one color is
possible.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agogitweb: Incremental blame (using JavaScript)
Jakub Narebski [Tue, 1 Sep 2009 11:39:17 +0000 (13:39 +0200)]
gitweb: Incremental blame (using JavaScript)

Add 'blame_incremental' view, which uses "git blame --incremental"
and JavaScript (Ajax), where 'blame' use "git blame --porcelain".

 * gitweb generates initial info by putting file contents (from
   "git cat-file") together with line numbers in blame table
 * then gitweb makes web browser JavaScript engine call startBlame()
   function from gitweb.js
 * startBlame() opens XMLHttpRequest connection to 'blame_data' view,
   which in turn calls "git blame --incremental" for a file, and
   streams output of git-blame to JavaScript (gitweb.js)
 * XMLHttpRequest event handler updates line info in blame view as soon
   as it gets data from 'blame_data' (from server), and it also updates
   progress info
 * when 'blame_data' ends, and gitweb.js finishes updating line info,
   it fixes colors to match (as far as possible) ordinary 'blame' view,
   and updates information about how long it took to generate page.

Gitweb deals with streamed 'blame_data' server errors by displaying
them in the progress info area (just in case).

The 'blame_incremental' view tries to be equivalent to 'blame' action;
there are however a few differences in output between 'blame' and
'blame_incremental' view:

 * 'blame_incremental' always used query form for this part of link(s)
   which is generated by JavaScript code.  The difference is visible
   if we use path_info link (pass some or all arguments in path_info).
   Changing this would require implementing something akin to href()
   subroutine from gitweb.perl in JavaScript (in gitweb.js).
 * 'blame_incremental' always uses "rowspan" attribute, even if
   rowspan="1".  This simplifies code, and is not visible to user.
 * The progress bar and progress info are still there even after
   JavaScript part of 'blame_incremental' finishes work.

Note that currently no link generated by gitweb leads to this new view.

This code is based on patch by Petr Baudis <pasky@suse.cz> patch, which
in turn was tweaked up version of Fredrik Kuivinen <frekui@gmail.com>'s
proof of concept patch.

This patch adds GITWEB_JS compile configuration option, and modifies
git-instaweb.sh to take gitweb.js into account.  The code for
git-instaweb.sh was taken from Pasky's patch.

Signed-off-by: Fredrik Kuivinen <frekui@gmail.com>
Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agogitweb: Add optional "time to generate page" info in footer
Jakub Narebski [Tue, 1 Sep 2009 11:39:16 +0000 (13:39 +0200)]
gitweb: Add optional "time to generate page" info in footer

Add "This page took XXX seconds and Y git commands to generate"
to page footer, if global feature 'timed' is enabled (disabled
by default).  Requires Time::HiRes installed for high precision
'wallclock' time.

Note that Time::HiRes is being required unconditionally; this is
because setting $t0 variable needs to be done fairly early to have
running time of the whole script.  If Time::HiRes module were required
only if 'timed' feature is enabled, the earliest place where starting
time ($t0) could be calculated would be after reading gitweb config,
making "time to generate page" info inaccurate.

This code is based on example code by Petr 'Pasky' Baudis.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agogitweb: Use light/dark for class names also in 'blame' view
Jakub Narebski [Fri, 24 Jul 2009 22:44:06 +0000 (00:44 +0200)]
gitweb: Use light/dark for class names also in 'blame' view

Instead of using "light2" and "dark2" for class names in 'blame' view
(in place of "light" and "dark" classes in other places) to avoid
changing style on hover in 'blame' view while doing it for other views
(like 'shortlog'), use more advanced CSS, relying on the fact that
more specific selector wins.

While at it add a few comments to gitweb CSS file, and consolidate
some repeated info.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agogitweb: Add author initials in 'blame' view, a la "git gui blame"
Jakub Narebski [Fri, 24 Jul 2009 22:44:05 +0000 (00:44 +0200)]
gitweb: Add author initials in 'blame' view, a la "git gui blame"

For example for "Junio C Hamano" initials would be "JH".  Of course
initials are added (below shortened SHA-1 of blamed commit) only if
group of lines that blame the same commit has 2 or more lines in it.

Initials are extracted using i18n /\b([[:upper:]])\B/g regexp.

Additionally initials help to distinguish boundary commits, as they
use bold weight font too (in addition to shortened SHA-1 of commit).

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agogitweb: Mark commits with no "previous" in 'blame' view
Jakub Narebski [Fri, 24 Jul 2009 22:44:04 +0000 (00:44 +0200)]
gitweb: Mark commits with no "previous" in 'blame' view

Use "no-previous" class to mark blamed commits which do not have
"previous" header.  Those are commits in which blamed file was created
(added); this includes boundary commits.  This means that 'linenr'
link leads to blamed commit, not (one of) parent of blamed commit.
Therefore currently line number for such commit uses bold weight font
to denote this situation; the effect is subtle.

Use "multiple-previous" class in the opposite situation, where blamed
commit has multiple "previous" headers (is an evil merge).  Currently
this class is not used for styling.  In this situation 'linenr' link
leads to first of "previous" commits (first parent).

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agogitweb: Use "previous" header of git-blame -p in 'blame' view
Jakub Narebski [Fri, 24 Jul 2009 22:44:03 +0000 (00:44 +0200)]
gitweb: Use "previous" header of git-blame -p in 'blame' view

Luben Tuikov changed 'lineno' link (line number link) from pointing to
'blame' view at given line at blamed commit, to the one at parent of
blamed commit in
  244a70e (Blame "linenr" link jumps to previous state at
           "orig_lineno", 2007-01-04).
This made it possible to do data mining using 'blame' view, by going
through history of a line using mentioned line number link.

Original implementation called "git rev-parse <commit>^" to find SHA-1
of a parent of a given commit once per each blamed line.  In
  39c19ce (gitweb: cache $parent_commit info in git_blame(),
           2008-12-11)
this was improved so rev-parse was called once per each unique commit
in git-blame output.  Alternate solution would be to relax validation
for 'hb' parameter by allowing extended SHA-1 syntax of the form
<rev>^ (perhaps redirecting to gitweb URL with <rev>^ resolved, in
practice moving call to rev-parse to 'the other side of link').

This solution had a bug that it didn't work for boundary commits.
Boundary commits don't have parents, so "git rev-parse <commit>^"
returned literal "<commit>^" (which didn't exists).  Gitweb didn't
detect this situation and passed this result literally as 'hb'
parameter in 'linenr' link.  Following such link currently gives
  400 - Invalid hash base parameter
error; 'hb' parameter is restricted via validate_refname to correct
refnames and doesn't allow for extended SHA-1 syntax.  This bug could
have been fixed alternatively by checking if commit is boundary commit,
or check if rev-parse result is unchanged (still ends in '^' prefix).

The solution employing rev-parse to find parent of commit had inherent
problem if blamed commit renamed file; then name of file would be
different in its parent.  Solving this outside git-blame would be
difficult and costly (at least cost of additional fork for extra git
command).

Currently gitweb uses information in "previous" header, which was
introduced by Junio C Hamano in
  96e1170 (blame: show "previous" information in
           --porcelain/--incremental format, 2008-06-04)
This (currently undocumented) header has the following format:
  "previous <sha1 of parent commit> <filename at parent>"
Using "previous" header solves both problem of performance and the
problem that blamed commit could have renaming blamed file.

Because "previous" header can be repeated for the same commit when
blamed commit is merge (has more than one parent), and we are
interested usually in _first_ parent, currently we store only first
value if blame header repeats.  Using first parent (first "previous"
line) was what gitweb did before; without this change gitweb would use
last parent instead.

If there is no previous commit 'linenr' link points to blamed commit
and blamed filename, making it work correctly for boundary commits.

Acked-by: Luben Tuikov <ltuikov@yahoo.com>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agogitweb: Mark boundary commits in 'blame' view
Jakub Narebski [Fri, 24 Jul 2009 22:44:02 +0000 (00:44 +0200)]
gitweb: Mark boundary commits in 'blame' view

Use "boundary" class to mark boundary commits, which currently results
in using bold weight font for SHA-1 of a commit (to be more exact for
all text in the first cell in row, that contains SHA-1 of a commit).

Detecting boundary commits is done by watching for "boundary" header
in "git blame -p" output.  Because this header doesn't carry
additional data the regular expression for blame header fields
had to be slightly adjusted.

With current gitweb API only root (parentless) commits can be boundary
commits.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agogitweb: Make .error style generic
Jakub Narebski [Fri, 24 Jul 2009 22:44:01 +0000 (00:44 +0200)]
gitweb: Make .error style generic

Style for td.error was introduced in 1f1ab5f (gitweb: style done with
stylesheet, 2006-06-20) to replace inline style for errors in old
multi-column "git annotate" based 'blame' view.  This view was then
since removed (replaced by "git-blame" based 'blame' view, with fewer
colums), making this style unused.

Make this style more generic by replacing td.error with .error to make
it apply to any element.  It will be used in 'blame_incremental' view
to show error messages.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoShow the presence of untracked files in the bash prompt.
Daniel Trstenjak [Wed, 22 Jul 2009 08:31:34 +0000 (10:31 +0200)]
Show the presence of untracked files in the bash prompt.

Added the envvar GIT_PS1_SHOWUNTRACKEDFILES to 'git-completion.bash'.
When set to a nonempty value, then the char '%' will be shown next
to the branch name in the bash prompt.

Signed-off-by: Daniel Trstenjak <daniel.trstenjak@science-computing.de>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'maint'
Junio C Hamano [Fri, 24 Jul 2009 16:27:09 +0000 (09:27 -0700)]
Merge branch 'maint'

* maint:
  SunOS grep does not understand -C<n> nor -e
  Fix export_marks() error handling.
  git branch: clean up detached branch handling
  git branch: avoid unnecessary object lookups
  git branch: fix performance problem
  do_one_ref(): null_sha1 check is not about broken ref

Conflicts:
Makefile

14 years agoSunOS grep does not understand -C<n> nor -e
Junio C Hamano [Fri, 24 Jul 2009 05:30:07 +0000 (22:30 -0700)]
SunOS grep does not understand -C<n> nor -e

The first "grep -C1" test in t7002 does not pass on my SunOS-5.11-i86pc,
and that is not because our way to spawn external grep is broken, but
because the native grep does not understand -C<n>.

It turns out that Peff was also using this option himself because our
Makefile doesn't do that automatically.  Brandon Casey uses SUNWspro
compiler without having to set this, and it turns out that the compiler
does not define preprocessor macro __unix__ which made him always use the
built-in grep, never an external one.

Let's be more explicit and say that we do not use external grep on Suns.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoFix export_marks() error handling.
Matthias Andree [Fri, 24 Jul 2009 08:17:13 +0000 (10:17 +0200)]
Fix export_marks() error handling.

- Don't leak one FILE * on error per export_marks() call. Found with
  cppcheck and reported by Martin Ettl.

- Abort the potentially long for(;idnums.size;) loop on write errors.

- Record error if fprintf() fails for reasons not required to set the
  stream error indicator, such as ENOMEM.

- Add a trailing full-stop to error message when fopen() fails.

Signed-off-by: Matthias Andree <matthias.andree@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agogit branch: clean up detached branch handling
Linus Torvalds [Thu, 23 Jul 2009 19:13:48 +0000 (12:13 -0700)]
git branch: clean up detached branch handling

Make the 'show detached branch info' a routine of its own.  And in the
process, avoid the object lookup that is unnecessary if the current
branch isn't detached.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agogit branch: avoid unnecessary object lookups
Linus Torvalds [Thu, 23 Jul 2009 19:05:34 +0000 (12:05 -0700)]
git branch: avoid unnecessary object lookups

They can be expensive in the cold-cache case, so don't bother looking up
the commits for all branches unless we really need them for some reason.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agogit branch: fix performance problem
Linus Torvalds [Thu, 23 Jul 2009 17:17:04 +0000 (10:17 -0700)]
git branch: fix performance problem

'git branch' looks at _all_ the refs, and verifies them.  Which means that
during cold-cache situations with a slow disk (and lots of tags, for
example) it can take several very annoying seconds (7.5s according to a
report by Carlos R.  Mafra).

This avoids most of it by simply doing the filtering before looking up
the commits, by using the "raw" version of for_each_ref.

Reported-by: Carlos R. Mafra <crmafra2@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agogit svn: fix shallow clone when upstream revision is too new
Eric Wong [Mon, 20 Jul 2009 09:06:24 +0000 (02:06 -0700)]
git svn: fix shallow clone when upstream revision is too new

Thanks to Ka-Hing Cheung for the initial bug report and patch:
> git-svn uses $ra->get_latest_revnum to find out the latest
> revision, but that can be problematic, because get_latest_revnum
> returns the latest revnum in the entire repository, not
> restricted by whatever URL you used to construct $ra. So if you
> do git svn clone -r HEAD svn://blah/blah/trunk, it won't work if
> the latest checkin is in one of the branches (it will try to
> fetch a rev that doesn't exist in trunk, making the clone
> useless).

Relying on SVN::Core::INVALID_REVNUM (-1) as the "start"
argument to SVN::Ra::get_log() proved unreliable with http(s)
URLs so the result of SVN::Ra::get_latest_revnum() is used as
the "start" argument instead.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
14 years agodo_one_ref(): null_sha1 check is not about broken ref
Junio C Hamano [Thu, 23 Jul 2009 06:07:05 +0000 (23:07 -0700)]
do_one_ref(): null_sha1 check is not about broken ref

f8948e2 (remote prune: warn dangling symrefs, 2009-02-08) introduced a
more dangerous variant of for_each_ref() family that skips the check for
dangling refs, but it also made another unrelated check optional by
mistake.

The check to see if a ref points at 0{40} is not about brokenness, but is
about a possible future plan to represent a deleted ref by writing 40 "0"
in a loose ref when there is a stale version of the same ref already in
.git/packed-refs, so that we can implement deletion of a ref without
having to rewrite the packed refs file excluding the ref being deleted.

This check has to live outside of the conditional.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoconfigure.ac: properly unset NEEDS_SSL_WITH_CRYPTO when sha1 func is missing v1.6.4-rc2
Brandon Casey [Wed, 22 Jul 2009 22:20:53 +0000 (17:20 -0500)]
configure.ac: properly unset NEEDS_SSL_WITH_CRYPTO when sha1 func is missing

The empty assignment NEEDS_SSL_WITH_CRYPTO= was mistakenly paired with the
assignment NEEDS_SSL_WITH_CRYPTO=YesPlease in the "action-if-found"
parameter of the AC_CHECK_LIB macro.  The empty assignment was intended for
the "action-if-not-found" section, since in that case, the necessary sha1
hash function was not found and the internal sha1 implementation will be
used instead.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agojanitor: useless checks before free
Pierre Habouzit [Wed, 22 Jul 2009 21:51:55 +0000 (23:51 +0200)]
janitor: useless checks before free

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agojanitor: add DIV_ROUND_UP and use it.
Pierre Habouzit [Wed, 22 Jul 2009 21:34:35 +0000 (23:34 +0200)]
janitor: add DIV_ROUND_UP and use it.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agorefactor: use bitsizeof() instead of 8 * sizeof()
Pierre Habouzit [Wed, 22 Jul 2009 21:34:34 +0000 (23:34 +0200)]
refactor: use bitsizeof() instead of 8 * sizeof()

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agojanitor: use NULL and not 0 for pointers.
Pierre Habouzit [Wed, 22 Jul 2009 21:34:33 +0000 (23:34 +0200)]
janitor: use NULL and not 0 for pointers.

Brought to you thanks to coccinelle:

    ---8<----
    @@
    expression *E;
    @@
    (
      E ==
    - 0
    + NULL
    |
      E !=
    - 0
    + NULL
    |
      E =
    - 0
    + NULL
    )

    @@
    identifier f;
    type T;
    @@
    T *f(...) {
    <...
    - return 0;
    + return NULL;
    ...>
    }
    --->8----

There are a lot more hits in compat/nedmallox and compat/regex but these
are borrowed code we rather do not want to maintain our own forks for,
and this patch refrains from touching them.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agogit stash: modernize use of "dashed" git-XXX calls
Martin Koegler [Wed, 22 Jul 2009 05:30:58 +0000 (07:30 +0200)]
git stash: modernize use of "dashed" git-XXX calls

Replace remaining git-XXX calls with git XXX.

Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at>
Acked-by: Nanako Shiraishi <nanako3@lavabit.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoImprove doc for format-patch threading options.
Yann Dirson [Wed, 22 Jul 2009 21:39:31 +0000 (23:39 +0200)]
Improve doc for format-patch threading options.

This hopefully makes the relationship between threading options of
format-patch and send-email easier to grasp.

Signed-off-by: Yann Dirson <ydirson@altern.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoList send-email config options in config.txt.
Yann Dirson [Wed, 22 Jul 2009 21:39:30 +0000 (23:39 +0200)]
List send-email config options in config.txt.

Also mention deprecated aliases that do not appear in the send-email
manpage.

Signed-off-by: Yann Dirson <ydirson@altern.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoconfigure.ac: rework/fix the NEEDS_RESOLV and NEEDS_LIBGEN tests
Brandon Casey [Tue, 21 Jul 2009 20:23:06 +0000 (15:23 -0500)]
configure.ac: rework/fix the NEEDS_RESOLV and NEEDS_LIBGEN tests

The "action" parameters for these two tests were supplied incorrectly for
the way the tests were implemented.  The tests check whether a program
which calls hstrerror() or basename() successfully links when -lresolv or
-lgen are used, respectively.  A successful linking would result in
NEEDS_RESOLV or NEEDS_LIBGEN being unset, and failure would result in
setting the respective variable.

Aside from that issue, the tests did not handle the case where neither
library was necessary for accessing the functions in question.  So solve
both of these issues by re-working the two tests so that their form is like
the NEEDS_SOCKET test which attempts to link with just the c library, and
if it fails then assumes that the additional library is necessary and sets
the appropriate variable.

Also an entry in the config.mak.in file is necessary for the NEEDS_LIBGEN
variable to appear in the config.mak.autogen file with the value assigned
by the configure script.  Without it, the generated shell script would
contain a snippet like this:

   for ac_lib in ; do
      ...

which is incorrect.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'maint'
Junio C Hamano [Thu, 23 Jul 2009 04:56:46 +0000 (21:56 -0700)]
Merge branch 'maint'

* maint:
  Trailing whitespace and no newline fix
  diff --cc: a lost line at the beginning of the file is shown incorrectly
  combine-diff.c: fix performance problem when folding common deleted lines

14 years agoTrailing whitespace and no newline fix
SZEDER Gábor [Thu, 23 Jul 2009 00:24:38 +0000 (19:24 -0500)]
Trailing whitespace and no newline fix

If a patch adds a new line to the end of a file and this line ends with
one trailing whitespace character and has no newline, then
'--whitespace=fix' currently does not remove that trailing whitespace.

This patch fixes this by removing the check for trailing whitespace at
the end of the line at a hardcoded offset which does not take the
eventual absence of newline into account.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agodiff --cc: a lost line at the beginning of the file is shown incorrectly
Junio C Hamano [Wed, 22 Jul 2009 21:48:29 +0000 (14:48 -0700)]
diff --cc: a lost line at the beginning of the file is shown incorrectly

When combine-diff inspected the diff from one parent to the merge result,
it misinterpreted a header in the form @@ -l,k +0,0 @@.

This hunk header means that K lines were removed from the beginning of the
file, so the lost lines must be queued to the sline that represents the
first line of the merge result, but we incremented our pointer incorrectly
and ended up queuing it to the second line, which in turn made the lossage
appear _after_ the first line.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agocombine-diff.c: fix performance problem when folding common deleted lines
Junio C Hamano [Wed, 22 Jul 2009 21:48:28 +0000 (14:48 -0700)]
combine-diff.c: fix performance problem when folding common deleted lines

For a deleted line in a patch with the parent we are looking at, the
append_lost() function finds the same line among a run of lines that were
deleted from the same location by patches from parents we previously
checked.  This is so that patches with two parents

    @@ -1,4 +1,3 @@    @@ -1,4 +1,3 @@
     one                   one
    -two                  -two
     three                 three
    -quatro               -fyra
    +four                 +four

can be coalesced into this sequence, reusing one line that describes the
removal of "two" for both parents.

   @@@ -1,4 -1,4 +1,3 @@@
     one
   --two
     three
   - quatro
    -frya
   ++four

While reading the second patch (that removes "two" and then "fyra"), after
finding where removal of the "two" matches, we need to find existing
removal of "fyra" (if exists) in the removal list, but the match has to
happen after all the existing matches (in this case "two").  The code used
a naïve O(n^2) algorithm to compute this by scanning the whole removal
list over and over again.

This patch remembers where the next scan should be started in the existing
removal list to avoid this.

Noticed by Linus Torvalds.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agogit svn: fix reparenting when ugly http(s) URLs are used
Eric Wong [Mon, 20 Jul 2009 05:08:45 +0000 (22:08 -0700)]
git svn: fix reparenting when ugly http(s) URLs are used

Mishandling of http(s) in need of escaping was causing
t9118-git-svn-funky-branch-names to fail when SVN_HTTPD_PORT
 was defined.

This bug was exposed in (but not caused by)
commit 0b2af457a49e3b00d47d556d5301934d27909db8
(Fix branch detection when repository root is inaccessible)

Signed-off-by: Eric Wong <normalperson@yhbt.net>
14 years agogit svn: rename tests that had conflicting numbers
Eric Wong [Sun, 19 Jul 2009 10:08:27 +0000 (03:08 -0700)]
git svn: rename tests that had conflicting numbers

Some unrelated tests were developed simultaneously and resulted
in test numbers conflicting.  To avoid difficulty when referring
to tests via the "tXXXX" convention, rename the newer tests.

Suggested by Marc Branchaud.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
14 years agoUpdates to draft release notes to 1.6.4
Junio C Hamano [Sat, 18 Jul 2009 20:01:49 +0000 (13:01 -0700)]
Updates to draft release notes to 1.6.4

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agopush: do not give big warning when no preference is configured
Junio C Hamano [Sun, 19 Jul 2009 00:19:47 +0000 (17:19 -0700)]
push: do not give big warning when no preference is configured

If the message said "we will be changing the default in the future, so
this is to warn people who want to keep the current default what to do",
it would have made some sense, but as it stands, the message is merely an
unsolicited advertisement for a new feature, which it is not helpful at
all.  Squelch it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agot4202-log.sh: Test git log --no-walk sort order
Michael J Gruber [Fri, 17 Jul 2009 14:28:06 +0000 (16:28 +0200)]
t4202-log.sh: Test git log --no-walk sort order

'git log --no-walk' sorts commits by commit time whereas 'git show' does
not (it leaves them as given on the command line). Document this by two
tests so that we never forget why ba1d450 (Tentative built-in "git
show", 2006-04-15) introduced it and 8e64006 (Teach revision machinery
about --no-walk, 2007-07-24) exposed it as an option argument.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agocvsexportcommit: reorder tests to quiet intermittent failure
Mike Ralphson [Wed, 15 Jul 2009 14:34:24 +0000 (15:34 +0100)]
cvsexportcommit: reorder tests to quiet intermittent failure

Reorder tests introduced in fef3a7cc and 54d5cc0e so an intermittent but
unimportant failure on the CVS side related to the former does not interfere
with what is actually being tested.

Signed-off-by: Mike Ralphson <mike@abacus.co.uk>
Tested-by: Tommy Nordgren <tommy.nordgren@comhem.se>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'maint'
Junio C Hamano [Sat, 18 Jul 2009 23:57:47 +0000 (16:57 -0700)]
Merge branch 'maint'

* maint:
  checkout -f: deal with a D/F conflict entry correctly
  sha1_name.c: avoid unnecessary strbuf_release
  refs.c: release file descriptor on error return

14 years agocheckout -f: deal with a D/F conflict entry correctly
Junio C Hamano [Sat, 18 Jul 2009 19:26:38 +0000 (12:26 -0700)]
checkout -f: deal with a D/F conflict entry correctly

When we switch branches with "checkout -f", unpack_trees() feeds two
cache_entries to oneway_merge() function in its src[] array argument.  The
zeroth entry comes from the current index, and the first entry represents
what the merge result should be, taken from the tree recorded in the
commit we are switching to.

When we have a blob (either regular file or a symlink) in the index and in
the work tree at path "foo", and the switched-to tree has "foo/bar",
i.e. "foo" becomes a directory, src[0] is obviously that blob currently
registered at "foo".  Even though we do not have anything at "foo" in the
switched-to tree, src[1] is _not_ NULL in this case.

The unpack_trees() machinery places a special marker df_conflict_entry
to signal that no blob exists at "foo", but it will become a directory
that may have somthing underneath it (namely "foo/bar"), so a usual 3-way
merge can notice the situation.

But oneway_merge() codepath failed to notice this and passed the special
marker directly to merged_entry().  This happens to remove the "foo" in
the end because the df_conflict_entry does not have any name (hence the
"error" message) and its addition in add_index_entry() is rejected, but it
is wrong.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agosha1_name.c: avoid unnecessary strbuf_release
Brandon Casey [Thu, 16 Jul 2009 21:25:19 +0000 (16:25 -0500)]
sha1_name.c: avoid unnecessary strbuf_release

When we fall back to a standard for_each_reflog_ent() after failing to find
the nth branch switch (or if we had a short reflog) with the call to
for_each_recent_reflog_ent(), we do not need to free the memory allocated
for our strbuf's since a strbuf_reset() will be performed in
grab_nth_branch_switch() before assigning to the entry.

Plus, the strbuf_release() negates the non-zero hint we initially gave to
strbuf_init() just above these lines.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agorefs.c: release file descriptor on error return
Brandon Casey [Thu, 16 Jul 2009 21:25:18 +0000 (16:25 -0500)]
refs.c: release file descriptor on error return

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoRevert "mailinfo: Remove only one set of square brackets" v1.6.4-rc1
Junio C Hamano [Wed, 15 Jul 2009 22:10:06 +0000 (15:10 -0700)]
Revert "mailinfo: Remove only one set of square brackets"

This reverts commit 650d30d8a120c8982309ccb9ef40432b4ea2eb74.

Some mailing lists are configured add prefix "[listname] " to all their
messages, and also people hand-edit subject lines, be it an output from
format-patch or a patch generated by some other means.

We cannot stop people from mucking with the subject line, and with the
change, there always will be need for hand editing the subject when that
happens.  People have depended on the leading [bracketed string] removal.

14 years agoFix extraneous lstat's in 'git checkout -f'
Linus Torvalds [Tue, 14 Jul 2009 21:19:10 +0000 (14:19 -0700)]
Fix extraneous lstat's in 'git checkout -f'

In our 'oneway_merge()' we always do an 'lstat()' to see if we might
need to mark the entry for updating.

But we really shouldn't need to do that when the cache entry is already
marked as being ce_uptodate(), and this makes us do unnecessary lstat()
calls if we have index preloading enabled.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoImprove on the 'invalid object' error message at commit time
Linus Torvalds [Tue, 14 Jul 2009 18:25:17 +0000 (11:25 -0700)]
Improve on the 'invalid object' error message at commit time

Not that anybody should ever get it, but somebody did (probably because
of a flaky filesystem, but whatever).  And each time I see an error
message that I haven't seen before, I decide that next time it will look
better.

So this makes us write more relevant information about exactly which
file ended up having issues with a missing object.  Which will tell
whether it was a tree object, for example, or just a regular file in the
index (and which one).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMake 'git show' more useful
Linus Torvalds [Mon, 13 Jul 2009 21:41:12 +0000 (14:41 -0700)]
Make 'git show' more useful

For some reason, I ended up doing

git show HEAD~5..

as an odd way of asking for a log. I realize I should just have used "git
log", but at the same time it does make perfect conceptual sense. After
all, you _could_ have done

git show HEAD HEAD~1 HEAD~2 HEAD~3 HEAD~4

and saying "git show HEAD~5.." is pretty natural. It's not like "git show"
only ever showed a single commit (or other object) before either! So
conceptually, giving a commit range is a very sensible operation, even
though you'd traditionally have used "git log" for that.

However, doing that currently results in an error

fatal: object ranges do not make sense when not walking revisions

which admittedly _also_ makes perfect sense - from an internal git
implementation standpoint in 'revision.c'.

However, I think that asking to show a range makes sense to a user, while
saying "object ranges no not make sense when not walking revisions" only
makes sense to a git developer.

So on the whole, of the two different "makes perfect sense" behaviors, I
think I originally picked the wrong one. And quite frankly, I don't really
see anybody actually _depending_ on that error case. So why not change it?

So rather than error out, just turn that non-walking error case into a
"silently turn on walking" instead.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agobash: add '--merges' to common 'git log' options
SZEDER Gábor [Mon, 13 Jul 2009 15:11:45 +0000 (17:11 +0200)]
bash: add '--merges' to common 'git log' options

... so it's available for git log, shortlog and gitk.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoDocument 'git (rev-list|log) --merges'
SZEDER Gábor [Mon, 13 Jul 2009 15:11:44 +0000 (17:11 +0200)]
Document 'git (rev-list|log) --merges'

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agogitweb: update Git homepage URL
Wincent Colaiuta [Sun, 12 Jul 2009 12:31:28 +0000 (14:31 +0200)]
gitweb: update Git homepage URL

git-scm.com is now the "official" Git project page, having taken over
from git.or.cz, so update the default link accordingly. This saves a
redirect when people hit git.or.cz.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agogit svn: allow uppercase UUIDs from SVN
Eric Wong [Sat, 11 Jul 2009 21:13:12 +0000 (14:13 -0700)]
git svn: allow uppercase UUIDs from SVN

SVN allows uppercase A-F characters in repositories.  Although
`svnadmin' does not create UUIDs with uppercase by default, it
is possible to change the UUID of a SVN repository and SVN
itself will make no attempt to normalize them.

Thanks to Esben Skovenborg for discovering this issue.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
14 years agogit-svn: Fix branch detection when repository root is inaccessible
Mattias Nissler [Mon, 6 Jul 2009 23:40:02 +0000 (01:40 +0200)]
git-svn: Fix branch detection when repository root is inaccessible

For the case of multiple projects sharing a single SVN repository, it is
common practice to create the standard SVN directory layout within a
subdirectory for each project. In such setups, access control is often
used to limit what projects a given user may access. git-svn failed to
detect branches (e.g. when passing --stdlayout to clone) because it
relied on having access to the root directory in the repository. This
patch solves this problem by making git-svn use paths relative to the
given repository URL instead of the repository root.

Signed-off-by: Mattias Nissler <mattias.nissler@gmx.de>
Acked-by: Eric Wong <normalperson@yhbt.net>
14 years agogit-svn: Always duplicate paths returned from get_log
Mattias Nissler [Mon, 6 Jul 2009 23:39:52 +0000 (01:39 +0200)]
git-svn: Always duplicate paths returned from get_log

This makes get_log more safe to use because callers cannot run into path
clobbering any more. The additional overhead will not affect performance
since the critical calls from the fetch loop need the path duplication
anyway and the rest of the call sites is not performance critical.

Signed-off-by: Mattias Nissler <mattias.nissler@gmx.de>
Acked-by: Eric Wong <normalperson@yhbt.net>
14 years agoquickfetch(): Prevent overflow of the rev-list command line
Johan Herland [Thu, 9 Jul 2009 23:52:30 +0000 (01:52 +0200)]
quickfetch(): Prevent overflow of the rev-list command line

quickfetch() calls rev-list to check whether the objects we are about to
fetch are already present in the repo (if so, we can skip the object fetch).
However, when there are many (~1000) refs to be fetched, the rev-list
command line grows larger than the maximum command line size on some systems
(32K in Windows). This causes rev-list to fail, making quickfetch() return
non-zero, which unnecessarily triggers the transport machinery. This somehow
causes fetch to fail with an exit code.

By using the --stdin option to rev-list (and feeding the object list to its
standard input), we prevent the overflow of the rev-list command line,
which causes quickfetch(), and subsequently the overall fetch, to succeed.

However, using rev-list --stdin is not entirely straightforward: rev-list
terminates immediately when encountering an unknown object, which can
trigger SIGPIPE if we are still writing object's to its standard input.
We therefore temporarily ignore SIGPIPE so that the fetch process is not
terminated.

The patch also contains a testcase to verify the fix (note that before
the patch, the testcase would only fail on msysGit).

Signed-off-by: Johan Herland <johan@herland.net>
Improved-by: Johannes Sixt <j6t@kdbg.org>
Improved-by: Alex Riesen <raa.lkml@gmail.com>
Tested-by: Peter Krefting <peter@softwolves.pp.se>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMakefile: update IRIX64 section
Brandon Casey [Fri, 10 Jul 2009 18:31:19 +0000 (13:31 -0500)]
Makefile: update IRIX64 section

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMakefile: add section for SGI IRIX 6.5
Brandon Casey [Fri, 10 Jul 2009 17:10:46 +0000 (12:10 -0500)]
Makefile: add section for SGI IRIX 6.5

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMakefile: add NEEDS_LIBGEN to optionally add -lgen to compile arguments
Brandon Casey [Fri, 10 Jul 2009 17:10:45 +0000 (12:10 -0500)]
Makefile: add NEEDS_LIBGEN to optionally add -lgen to compile arguments

Commit 003b33a8 recently added a call to basename().  On IRIX 6.5, this
function resides in libgen and -lgen is required for the linker.

Update configure.ac too.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agogit-compat-util.h: adjust for SGI IRIX 6.5
Brandon Casey [Fri, 10 Jul 2009 17:10:44 +0000 (12:10 -0500)]
git-compat-util.h: adjust for SGI IRIX 6.5

Don't define _XOPEN_SOURCE
Do    define _SGI_SOURCE

Defining _XOPEN_SOURCE prevents many of the common functions and macros
from being defined. _Not_ setting _XOPEN_SOURCE, and instead setting
_SGI_SOURCE, provides all of the XPG4, XPG5, BSD, POSIX functions and
declarations, _BUT_ provides a horribly broken snprintf(). SGI does have
a working snprintf(), but it is only provided when _NO_XOPEN5 evaluates
to zero, and this only happens if _XOPEN_SOURCE is defined which, as
mentioned above, prevents many other common functions and defines.

The broken snprintf will be worked around with SNPRINTF_RETURNS_BOGUS in
the Makefile in a later patch.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agounpack-trees.c: work around run-time array initialization flaw on IRIX 6.5
Brandon Casey [Fri, 10 Jul 2009 17:10:43 +0000 (12:10 -0500)]
unpack-trees.c: work around run-time array initialization flaw on IRIX 6.5

The c99 MIPSpro Compiler version 7.4.4m on IRIX 6.5 does not properly
initialize run-time initialized arrays.  An array which is initialized with
fewer elements than the length of the array should have the unitialized
elements initialized to zero.  This compiler only initializes the remaining
elements when the last element is a static parameter.  So work around it
by adding a "NULL" initialization parameter.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'lt/dir-cleanup'
Junio C Hamano [Sat, 11 Jul 2009 03:18:37 +0000 (20:18 -0700)]
Merge branch 'lt/dir-cleanup'

* lt/dir-cleanup:
  Make index preloading check the whole path to the file
  Export thread-safe version of 'has_symlink_leading_path()'
  Prepare symlink caching for thread-safety
  Avoid using 'lstat()' to figure out directories
  Avoid doing extra 'lstat()'s for d_type if we have an up-to-date cache entry
  Simplify read_directory[_recursive]() arguments
  Add 'fill_directory()' helper function for directory traversal

14 years agoMerge branch 'ae/maint-mailinfo-rm-only-one-patch-marker'
Junio C Hamano [Sat, 11 Jul 2009 03:18:09 +0000 (20:18 -0700)]
Merge branch 'ae/maint-mailinfo-rm-only-one-patch-marker'

* ae/maint-mailinfo-rm-only-one-patch-marker:
  mailinfo: Remove only one set of square brackets

14 years agoMakefile: keep "git" when bindir is execdir
Junio C Hamano [Sat, 11 Jul 2009 03:17:33 +0000 (20:17 -0700)]
Makefile: keep "git" when bindir is execdir

For some reason there still are people who use the old style layout
to put everything in $(bindir).  The previous commit breaks the install
for them, because it tries to unconditionally remove git from execdir
and cp/ln from bindir --- oops.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMake index preloading check the whole path to the file
Linus Torvalds [Thu, 9 Jul 2009 20:37:02 +0000 (13:37 -0700)]
Make index preloading check the whole path to the file

This uses the new thread-safe 'threaded_has_symlink_leading_path()'
function to efficiently verify that the whole path leading up to the
filename is a proper path, and does not contain symlinks.

This makes 'ce_uptodate()' a much stronger guarantee: it no longer just
guarantees that the 'lstat()' of the path would match, it also means
that we know that people haven't played games with moving directories
around and covered it up with symlinks.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoExport thread-safe version of 'has_symlink_leading_path()'
Linus Torvalds [Thu, 9 Jul 2009 20:35:31 +0000 (13:35 -0700)]
Export thread-safe version of 'has_symlink_leading_path()'

The threaded index preloading will want it, so that it can avoid
locking by simply using a per-thread symlink/directory cache.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoPrepare symlink caching for thread-safety
Linus Torvalds [Thu, 9 Jul 2009 20:23:59 +0000 (13:23 -0700)]
Prepare symlink caching for thread-safety

This doesn't actually change the external interfaces, so they are still
thread-unsafe, but it makes the code internally pass a pointer to a
local 'struct cache_def' around, so that the core code can be made
thread-safe.

The threaded index preloading will want to verify that the paths leading
up to a pathname are all real directories.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoAvoid using 'lstat()' to figure out directories
Linus Torvalds [Thu, 9 Jul 2009 20:14:28 +0000 (13:14 -0700)]
Avoid using 'lstat()' to figure out directories

If we have an up-to-date index entry for a file in that directory, we
can know that the directories leading up to that file must be
directories.  No need to do an lstat() on the directory.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMakefile: install 'git' in execdir v1.6.4-rc0
Jeff King [Thu, 9 Jul 2009 06:37:35 +0000 (02:37 -0400)]
Makefile: install 'git' in execdir

When a git command executes a subcommand, it uses the "git
foo" form, which relies on finding "git" in the PATH.
Normally this should not be a problem, since the same "git"
that was used to invoke git in the first place will be
found.  And if somebody invokes a "git" outside of the PATH
(e.g., by giving its absolute path), this case is already
covered: we put that absolute path onto the front of PATH.

However, if one is using "sudo", then sudo will execute the
"git" from the PATH, but pass along a restricted PATH that
may not contain the original "git" directory. In this case,
executing a subcommand will fail.

To solve this, we put the "git" wrapper itself into the
execdir; this directory is prepended to the PATH when git
starts, so the wrapper will always be found.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoAvoid doing extra 'lstat()'s for d_type if we have an up-to-date cache entry
Linus Torvalds [Thu, 9 Jul 2009 02:31:49 +0000 (19:31 -0700)]
Avoid doing extra 'lstat()'s for d_type if we have an up-to-date cache entry

On filesystems without d_type, we can look at the cache entry first.
Doing an lstat() can be expensive.

Reported by Dmitry Potapov for Cygwin.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoSimplify read_directory[_recursive]() arguments
Linus Torvalds [Thu, 9 Jul 2009 02:24:39 +0000 (19:24 -0700)]
Simplify read_directory[_recursive]() arguments

Stop the insanity with separate 'path' and 'base' arguments that must
match.  We don't need that crazy interface any more, since we cleaned up
handling of 'path' in commit da4b3e8c28b1dc2b856d2555ac7bb47ab712598c.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoAdd 'fill_directory()' helper function for directory traversal
Linus Torvalds [Thu, 14 May 2009 20:22:36 +0000 (13:22 -0700)]
Add 'fill_directory()' helper function for directory traversal

Most of the users of "read_directory()" actually want a much simpler
interface than the whole complex (but rather powerful) one.

In fact 'git add' had already largely abstracted out the core interface
issues into a private "fill_directory()" function that was largely
applicable almost as-is to a number of callers.  Yes, 'git add' wants to
do some extra work of its own, specific to the add semantics, but we can
easily split that out, and use the core as a generic function.

This function does exactly that, and now that much simplified
'fill_directory()' function can be shared with a number of callers,
while also ensuring that the rather more complex calling conventions of
read_directory() are used by fewer call-sites.

This also makes the 'common_prefix()' helper function private to dir.c,
since all callers are now in that file.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'ld/push-porcelain-output-format'
Junio C Hamano [Thu, 9 Jul 2009 08:07:54 +0000 (01:07 -0700)]
Merge branch 'ld/push-porcelain-output-format'

* ld/push-porcelain-output-format:
  add --porcelain option to git-push

14 years agoMerge branch 'gb/gitweb-avatar'
Junio C Hamano [Thu, 9 Jul 2009 08:00:59 +0000 (01:00 -0700)]
Merge branch 'gb/gitweb-avatar'

* gb/gitweb-avatar:
  gitweb: add empty alt text to avatar img
  gitweb: picon avatar provider
  gitweb: gravatar url cache
  gitweb: (gr)avatar support
  gitweb: use git_print_authorship_rows in 'tag' view too
  gitweb: uniform author info for commit and commitdiff
  gitweb: refactor author name insertion

14 years agoMerge branch 'ml/http'
Junio C Hamano [Thu, 9 Jul 2009 08:00:36 +0000 (01:00 -0700)]
Merge branch 'ml/http'

* ml/http:
  http.c: add http.sslCertPasswordProtected option
  http.c: prompt for SSL client certificate password

Conflicts:
http.c

14 years agoMerge branch 'rs/grep-p'
Junio C Hamano [Thu, 9 Jul 2009 07:59:58 +0000 (00:59 -0700)]
Merge branch 'rs/grep-p'

* rs/grep-p:
  grep: simplify -p output
  grep -p: support user defined regular expressions
  grep: add option -p/--show-function
  grep: handle pre context lines on demand
  grep: print context hunk marks between files
  grep: move context hunk mark handling into show_line()
  userdiff: add xdiff_clear_find_func()

14 years agoMerge branch 'js/run-command-updates' (early part)
Junio C Hamano [Thu, 9 Jul 2009 07:59:32 +0000 (00:59 -0700)]
Merge branch 'js/run-command-updates' (early part)

* 'js/run-command-updates' (early part):
  MinGW: truncate exit()'s argument to lowest 8 bits

14 years agomailinfo: Remove only one set of square brackets
Andreas Ericsson [Mon, 29 Jun 2009 09:55:51 +0000 (11:55 +0200)]
mailinfo: Remove only one set of square brackets

git-format-patch prepends patches with a [PATCH x/n] prefix, but
mailinfo used to remove any number of square-bracket pairs and
the content between them. This prevents one from using a commit
subject like this:

  [ and ] must be allowed as input

Removing the square bracket pair from this rather clumsily
constructed subject line loses important information, so we must
take care not to.

This patch causes the subject stripping to stop after it has
encountered one pair of square brackets.

One possible downside of this patch is that the patch-handling
programs will now fail at removing author-added square-brackets
to be removed, such as

  [RFC][PATCH x/n]

However, since format-patch only adds one set of square brackets,
this behaviour is quite easily undesrstood and defended while the
previous behaviour is not.

Signed-off-by: Andreas Ericsson <ae@op5.se>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agogit-svn.txt: fix description of fetch flags accepted by clone.
Yann Dirson [Tue, 7 Jul 2009 20:22:22 +0000 (22:22 +0200)]
git-svn.txt: fix description of fetch flags accepted by clone.

Signed-off-by: Yann Dirson <ydirson@altern.org>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agogit-svn.txt: fix fetch flags incorrectly documented as init flags.
Yann Dirson [Tue, 7 Jul 2009 20:22:21 +0000 (22:22 +0200)]
git-svn.txt: fix fetch flags incorrectly documented as init flags.

Signed-off-by: Yann Dirson <ydirson@altern.org>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agogit-svn.txt: make formatting more consistent.
Yann Dirson [Tue, 7 Jul 2009 20:22:20 +0000 (22:22 +0200)]
git-svn.txt: make formatting more consistent.

- correctly link paragraphs within list items
- consistently format examples
- put option alernatives on separate lines
- always use [verse] for config items
- always indent 1st paragraph of a list item, with a tab

Signed-off-by: Yann Dirson <ydirson@altern.org>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agogit-svn.txt: stop using dash-form of commands.
Yann Dirson [Tue, 7 Jul 2009 20:22:19 +0000 (22:22 +0200)]
git-svn.txt: stop using dash-form of commands.

Also consistently use single quotes around git commands to make things clear
(was only needed at a couple of places).

Signed-off-by: Yann Dirson <ydirson@altern.org>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'maint'
Junio C Hamano [Wed, 8 Jul 2009 17:42:23 +0000 (10:42 -0700)]
Merge branch 'maint'

* maint:
  Documentation: update description of shell aliases

14 years agoMerge branch 'cb/maint-fetch-refspec-wo-dst' into maint
Junio C Hamano [Wed, 8 Jul 2009 16:52:25 +0000 (09:52 -0700)]
Merge branch 'cb/maint-fetch-refspec-wo-dst' into maint

* cb/maint-fetch-refspec-wo-dst:
  fetch: do not create ref from empty name

14 years agoMerge branch 'cf/maint-remote-uploadpack-useconfig-fix' into maint
Junio C Hamano [Wed, 8 Jul 2009 16:52:14 +0000 (09:52 -0700)]
Merge branch 'cf/maint-remote-uploadpack-useconfig-fix' into maint

* cf/maint-remote-uploadpack-useconfig-fix:
  git-remote: fix missing .uploadpack usage for show command

14 years agoDocumentation: update description of shell aliases
Sitaram Chamarty [Wed, 1 Jul 2009 16:00:31 +0000 (21:30 +0530)]
Documentation: update description of shell aliases

Aliases that invoke shell commands start from the top-level directory,
but this was not documented.

Signed-off-by: Sitaram Chamarty <sitaramc@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agocompletion: __git_config_get_set_variables() handle values with spaces
Stephen Boyd [Tue, 30 Jun 2009 05:08:38 +0000 (22:08 -0700)]
completion: __git_config_get_set_variables() handle values with spaces

Commit 0065236 (bash completion: complete variable names for "git
config" with options 2009-05-08) implemented its config variable search
wrong. When a config contains a value with a space and a period (.) in
it, completion erroneously thinks that line in the configuration is
multiple config variables.

For example

 $ cat .git/config
   format.cc = Junio C Hamano <gitster@pobox.com>

 $ git config --unset <TAB>
   format.cc
   <gitster@pobox.com>

Instead of using a for loop splitting across spaces, pipe each line to a
while read loop and beef up the case statement to match only
'config.variable=value'.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'tr/die_errno'
Junio C Hamano [Mon, 6 Jul 2009 16:39:46 +0000 (09:39 -0700)]
Merge branch 'tr/die_errno'

* tr/die_errno:
  Use die_errno() instead of die() when checking syscalls
  Convert existing die(..., strerror(errno)) to die_errno()
  die_errno(): double % in strerror() output just in case
  Introduce die_errno() that appends strerror(errno) to die()

14 years agoMerge branch 'cb/maint-fetch-refspec-wo-dst'
Junio C Hamano [Mon, 6 Jul 2009 16:39:38 +0000 (09:39 -0700)]
Merge branch 'cb/maint-fetch-refspec-wo-dst'

* cb/maint-fetch-refspec-wo-dst:
  fetch: do not create ref from empty name

14 years agoMerge branch 'sb/show-ref-parse-options'
Junio C Hamano [Mon, 6 Jul 2009 16:38:58 +0000 (09:38 -0700)]
Merge branch 'sb/show-ref-parse-options'

* sb/show-ref-parse-options:
  show-ref: migrate to parse-options

14 years agoMerge branch 'gb/am-foreign'
Junio C Hamano [Mon, 6 Jul 2009 16:38:33 +0000 (09:38 -0700)]
Merge branch 'gb/am-foreign'

* gb/am-foreign:
  git-am: refactor 'cleaning up and aborting'
  git-am foreign patch support: StGIT support
  git-am foreign patch support: autodetect some patch formats
  git-am foreign patch support: introduce patch_format

14 years agoMerge branch 'jk/use-our-regexp'
Junio C Hamano [Mon, 6 Jul 2009 16:38:08 +0000 (09:38 -0700)]
Merge branch 'jk/use-our-regexp'

* jk/use-our-regexp:
  Makefile: Solaris needs HAVE_ALLOCA_H for alloca()
  Makefile: use compat regex on Solaris
  Makefile: refactor regex compat support

14 years agoMerge branch 'uk/rev-parse-parse-opt'
Junio C Hamano [Mon, 6 Jul 2009 16:38:01 +0000 (09:38 -0700)]
Merge branch 'uk/rev-parse-parse-opt'

* uk/rev-parse-parse-opt:
  parse-opt: make PARSE_OPT_STOP_AT_NON_OPTION available to git rev-parse
  more tests for git rev-parse --parse-opt

14 years agoAvoid generating a warning if $fullname{$file} is undefined
Nick Woolley [Mon, 6 Jul 2009 13:33:45 +0000 (14:33 +0100)]
Avoid generating a warning if $fullname{$file} is undefined

Signed-off-by: Nick Woolley <git.wu-lee@noodlefactory.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoRemove archaic use of regex capture \1 in favour of $1
Nick Woolley [Mon, 6 Jul 2009 13:33:07 +0000 (14:33 +0100)]
Remove archaic use of regex capture \1 in favour of $1

Using it will generate a perl warning "\1 better written as $1".

Signed-off-by: Nick Woolley <git.wu-lee@noodlefactory.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agocompletion: Add --full-diff to log options
Todd Zullinger [Wed, 3 Jun 2009 20:20:58 +0000 (16:20 -0400)]
completion: Add --full-diff to log options

Signed-off-by: Todd Zullinger <tmz@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoAllow the Unix epoch to be a valid commit date
Eric Wong [Fri, 3 Jul 2009 04:34:54 +0000 (21:34 -0700)]
Allow the Unix epoch to be a valid commit date

It is common practice to use the Unix epoch as a fallback date
when a suitable date is not available.  This is true of git svn
and possibly other importing tools that import non-git history
into git.

Instead of clobbering established strtoul() error reporting
semantics with our own, preserve the strtoul() error value
of ULONG_MAX for fsck.c to handle.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agohttp-push: fix xml_entities() string parsing overrun
Hunter, D. Seth [Wed, 1 Jul 2009 00:24:47 +0000 (20:24 -0400)]
http-push: fix xml_entities() string parsing overrun

xml_entities() in http-push.c did not properly stop at the end of the
string being examined, which would occasionally cause nonsense to be
appended to escaped URL strings and result in failed DAV XML queries

Signed-off-by: Seth Hunter <hunter@ll.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>