git.git
16 years agoadd installation support to Makefile
Ben Walton [Sat, 14 Nov 2009 01:29:39 +0000 (20:29 -0500)]
add installation support to Makefile

Signed-off-by: Ben Walton <redacted>
16 years agoOops, forgot a COPYING file. It's GPLv2.
Avery Pennarun [Sun, 15 Nov 2009 17:13:08 +0000 (12:13 -0500)]
Oops, forgot a COPYING file.  It's GPLv2.

Thanks to Ben Walton for pointing this out.

16 years agoMerge branch 'maint'
Junio C Hamano [Sun, 15 Nov 2009 08:26:51 +0000 (00:26 -0800)]
Merge branch 'maint'

* maint:
  git-add.txt: fix formatting of --patch section

16 years agoremote: fix use-after-free error detected by glibc in ref_remove_duplicates
Julian Phillips [Fri, 13 Nov 2009 21:25:56 +0000 (21:25 +0000)]
remote: fix use-after-free error detected by glibc in ref_remove_duplicates

In ref_remove_duplicates, when we encounter a duplicate and remove it
from the list we need to make sure that the prev pointer stays
pointing at the last entry and also skip over adding the just freed
entry to the string_list.

Previously fetch could crash with:
*** glibc detected *** git: corrupted double-linked list: ...

Also add a test to try and catch problems with duplicate removal in
the future.

Acked-by: Nicolas Pitre <redacted>
Signed-off-by: Julian Phillips <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agoMakefile: Ensure rpm packages can be read by older rpm versions
Todd Zullinger [Wed, 11 Nov 2009 21:59:52 +0000 (16:59 -0500)]
Makefile: Ensure rpm packages can be read by older rpm versions

The kernel.org hosts where the packages are built are now using Fedora
11, which defaults to sha256 for file digests instead of md5.  Older
versions of rpm can not handle these packages.  Tell rpmbuild to use md5
file digests for better compatibility.

Signed-off-by: Todd Zullinger <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agobash: add the merge option --ff-only
Björn Gustavsson [Wed, 11 Nov 2009 04:49:07 +0000 (05:49 +0100)]
bash: add the merge option --ff-only

Signed-off-by: Björn Gustavsson <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agogitweb: Make 'history' view (re)use git_log_generic()
Jakub Narebski [Fri, 13 Nov 2009 01:02:14 +0000 (02:02 +0100)]
gitweb: Make 'history' view (re)use git_log_generic()

Make git_history use git_log_generic, passing git_history_body as one
of its paramaters.  This required changes to git_log_generic, in
particular passing more things as parameters.

While refactoring common code of 'log', 'shortlog' and 'history' view,
we did unify pagination, using always the form used by 'history' view,
namely
  first * prev * next
in place of
  HEAD * prev * next
used by 'log' and 'shortlog' views.

The 'history' view now supports commit limiting via 'hpb' parameter,
similarly to 'shortlog' (and 'log') view.  Performance of 'history'
view got improved a bit, as it doesn't run git_get_hash_by_path for
"current" version in a loop.  Error detection and reporting for
'history' view changed a bit.

Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agogitweb: Refactor common parts of 'log' and 'shortlog' views
Jakub Narebski [Fri, 13 Nov 2009 01:02:13 +0000 (02:02 +0100)]
gitweb: Refactor common parts of 'log' and 'shortlog' views

Put the common parts of git_log and git_shortlog into git_log_generic
subroutine: git_log and git_shortlog are now thin wrappers calling
git_log_generic with appropriate arguments.

The unification of code responsible for 'log' and 'shorlog' actions
lead to the following changes in gitweb output
 * 'tree' link in page_nav now uses $hash parameter, as was the case
   for 'shortlog' but not for 'log'
 * 'log' view now respect $hash_parent limiting, like 'shortlog' did
 * 'log' view doesn't have special case for empty list anymore, and it
   always uses page_header linking to summary view, like 'shortlog'
   did.

Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agogitweb: Refactor 'log' action generation, adding git_log_body()
Jakub Narebski [Fri, 13 Nov 2009 01:02:12 +0000 (02:02 +0100)]
gitweb: Refactor 'log' action generation, adding git_log_body()

Put the main part of 'log' view generation into git_log_body,
similarly how it is done for 'shortlog' and 'history' views (and
also for 'tags' and 'heads' views).

This is preparation for extracting common code between 'log',
'shortlog' and 'history' actions.

Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agogit svn: add authorsfile test case for ~/.gitconfig
Eric Wong [Sat, 14 Nov 2009 22:43:20 +0000 (14:43 -0800)]
git svn: add authorsfile test case for ~/.gitconfig

The commit for:
    git svn: read global+system config for clone+init

Initially lacked a test case because the author was unable to
reproduce it under his test environment, this adds it.

Signed-off-by: Eric Wong <redacted>
16 years agogit svn: read global+system config for clone+init
Eric Wong [Sat, 14 Nov 2009 22:25:11 +0000 (14:25 -0800)]
git svn: read global+system config for clone+init

Since $GIT_DIR does not exist when initializing new repositories,
we can follow back to the global and system config files for
git.

The logic for this was originally introduced when
$GIT_DIR/config was the only config file git could read (back
when "git config" was "git repo-config"), so the function is
renamed to "read_git_config" instead of "read_repo_config".

Signed-off-by: Eric Wong <redacted>
16 years agogit svn: handle SVN merges from revisions past the tip of the branch
Toby Allsopp [Sat, 14 Nov 2009 21:26:47 +0000 (13:26 -0800)]
git svn: handle SVN merges from revisions past the tip of the branch

When recording the revisions that it has merged, SVN sets the top
revision to be the latest revision in the repository, which is not
necessarily a revision on the branch that is being merged from.  When
it is not on the branch, git-svn fails to add the extra parent to
represent the merge because it relies on finding the commit on the
branch that corresponds to the top of the SVN merge range.

In order to correctly handle this case, we look for the maximum
revision less than or equal to the top of the SVN merge range that is
actually on the branch being merged from.

[ew: This includes the following (squashed) commit to prevent
     errors during bisect:]

  Author: Toby Allsopp <redacted>
  Date:   Fri Nov 13 09:48:39 2009 +1300

    git-svn: add (failing) test for SVN 1.5+ merge with intervening commit

    This test exposes a bug in git-svn's handling of SVN 1.5+ mergeinfo
    properties.  The problematic case is when there is some commit on an
    unrelated branch after the last commit on the merged-from branch.
    When SVN records the mergeinfo property, it records the latest
    revision in the whole repository, which, in the problematic case, is
    not on the branch it is merging from.

    To trigger the git-svn bug, we modify t9151 to include two SVN merges,
    the second of which has an intervening commit.  The SVN dump was
    generated using SVN 1.6.6 (on Debian squeeze amd64).

Signed-off-by: Toby Allsopp <redacted>
Acked-by: Eric Wong <redacted>
16 years agogitk: Default to the system colours on Windows
Pat Thoyts [Fri, 6 Nov 2009 23:28:01 +0000 (23:28 +0000)]
gitk: Default to the system colours on Windows

Also convert a button to use the themed widget set.

Signed-off-by: Pat Thoyts <redacted>
Signed-off-by: Paul Mackerras <redacted>
16 years agogitk: Merge branch 'dev' into master
Paul Mackerras [Sat, 14 Nov 2009 10:26:31 +0000 (21:26 +1100)]
gitk: Merge branch 'dev' into master

Signed-off-by: Paul Mackerras <redacted>
16 years agogitk: Update Japanese translation
Mizar [Sat, 14 Nov 2009 10:21:08 +0000 (21:21 +1100)]
gitk: Update Japanese translation

Signed-off-by: Paul Mackerras <redacted>
16 years agogitk: Fix "git gui blame" invocation when called from top-level directory
Markus Heidelberg [Tue, 3 Nov 2009 23:21:41 +0000 (00:21 +0100)]
gitk: Fix "git gui blame" invocation when called from top-level directory

When run in the top-level directory of a git repository, "git
rev-parse --git-dir" doesn't return an absolute path, but merely
".git", so the selected file for "git gui blame" has a relative path.
The function make_relative then tries to make the already relative
path relative, which results in a path like "../../../../Makefile"
with as many ".." as there are elements of [pwd].

This regression was introduced by commit 9712b81 (gitk: Fix bugs in
blaming code, 2008-12-06), which fixed "git gui blame" when called from
subdirs.

This also fixes it for bare repositories.

Signed-off-by: Markus Heidelberg <redacted>
Signed-off-by: Paul Mackerras <redacted>
16 years agogitk: Disable checkout of remote branches
Sitaram Chamarty [Tue, 3 Nov 2009 16:00:12 +0000 (21:30 +0530)]
gitk: Disable checkout of remote branches

At the command line, trying to check out a remote branch gives you a
detailed warning message, but the gitk GUI currently allows it without
any fuss.

Since the GUI is often used by people much less familiar with git, it
seems reasonable to make the GUI more restrictive than the command line,
not less.

This prevents a lot of detached HEAD commits by new users.

Signed-off-by: Sitaram Chamarty <redacted>
Signed-off-by: Paul Mackerras <redacted>
16 years agogitk: Improve appearance of radiobuttons and checkbuttons
Paul Mackerras [Sat, 14 Nov 2009 10:15:01 +0000 (21:15 +1100)]
gitk: Improve appearance of radiobuttons and checkbuttons

Commit 5497f7a23ac11f9b230892220d5ed80263eedd1f ("gitk: Add configuration
for UI colour scheme") added a call to tk_setPalette at startup.
Unfortunately, tk_setPalette always chooses a dark red color for
the selectColor value if none is given explicitly, and this makes
checkbuttons and radiobuttons look rather bad.

This restores the previous appearance by specifying selectColor
explicitly.  For light backgrounds we use white for selectColor, and
for dark backgrounds we use black.  The formula and threshold for
distinguishing light from dark are the same as used in tk_setPalette
for choosing the foreground color.

Signed-off-by: Paul Mackerras <redacted>
16 years agogit-add.txt: fix formatting of --patch section
Stephen Boyd [Sat, 14 Nov 2009 01:45:46 +0000 (17:45 -0800)]
git-add.txt: fix formatting of --patch section

Extra paragraphs should be prefixed with a plus sign.

Signed-off-by: Stephen Boyd <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agohttp-backend: Fix bad treatment of uintmax_t in Content-Length
Shawn O. Pearce [Thu, 12 Nov 2009 04:42:41 +0000 (20:42 -0800)]
http-backend: Fix bad treatment of uintmax_t in Content-Length

Our Content-Length needs to report an off_t, which could be larger
precision than size_t on this system (e.g. 32 bit binary built with
64 bit large file support).

We also shouldn't be passing a size_t parameter to printf when
we've used PRIuMAX as the format specifier.

Fix both issues by using uintmax_t for the hdr_int() routine,
allowing strbuf's size_t to automatically upcast, and off_t to
always fit.

Also fixed the copy loop we use inside of send_local_file(), we never
actually updated the size variable so we might as well not use it.

Reported-by: Tarmigan <redacted>
Signed-off-by: Shawn O. Pearce <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agogive priority to progress messages
Nicolas Pitre [Wed, 11 Nov 2009 22:24:42 +0000 (17:24 -0500)]
give priority to progress messages

In theory it is possible for sideband channel #2 to be delayed if
pack data is quick to come up for sideband channel #1.  And because
data for channel #2 is read only 128 bytes at a time while pack data
is read 8192 bytes at a time, it is possible for many pack blocks to
be sent to the client before the progress message fifo is emptied,
making the situation even worse.  This would result in totally garbled
progress display on the client's console as local progress gets mixed
with partial remote progress lines.

Let's prevent such situations by giving transmission priority to
progress messages over pack data at all times.

Signed-off-by: Nicolas Pitre <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agoProvide a build time default-pager setting
Junio C Hamano [Sat, 31 Oct 2009 01:45:34 +0000 (20:45 -0500)]
Provide a build time default-pager setting

Provide a DEFAULT_PAGER knob so packagers can set the fallback
pager to something appropriate during the build.

Examples:

On (old) solaris systems, /usr/bin/less (typically the first less
found) doesn't understand the default arguments (FXRS), which
forces users to alter their environment (PATH, GIT_PAGER, LESS,
etc) or have a local or global gitconfig before paging works as
expected.

On Debian systems, by policy packages must fall back to the
'pager' command, so that changing the target of the
/usr/bin/pager symlink changes the default pager for all packages
at once.

Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Ben Walton <redacted>
Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agoProvide a build time default-editor setting
Jonathan Nieder [Sat, 31 Oct 2009 01:44:41 +0000 (20:44 -0500)]
Provide a build time default-editor setting

Provide a DEFAULT_EDITOR knob to allow setting the fallback
editor to use instead of vi (when VISUAL, EDITOR, and GIT_EDITOR
are unset).  The value can be set at build time according to a
system’s policy.  For example, on Debian systems, the default
editor should be the 'editor' command.

Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Ben Walton <redacted>
Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agoam -i, git-svn: use "git var GIT_PAGER"
Jonathan Nieder [Sat, 31 Oct 2009 01:43:19 +0000 (20:43 -0500)]
am -i, git-svn: use "git var GIT_PAGER"

Use the new "git var GIT_PAGER" command to ask what pager to use.

Without this change, the core.pager configuration is ignored by
these commands.

Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agoadd -i, send-email, svn, p4, etc: use "git var GIT_EDITOR"
Jonathan Nieder [Sat, 31 Oct 2009 01:42:34 +0000 (20:42 -0500)]
add -i, send-email, svn, p4, etc: use "git var GIT_EDITOR"

Use the new "git var GIT_EDITOR" feature to decide what editor to
use, instead of duplicating its logic elsewhere.  This should make
the behavior of commands in edge cases (e.g., editor names with
spaces) a little more consistent.

Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agoTeach git var about GIT_PAGER
Jonathan Nieder [Sat, 31 Oct 2009 01:41:27 +0000 (20:41 -0500)]
Teach git var about GIT_PAGER

Expose the command found by setup_pager() for scripts to use.
Scripts can use this to avoid repeating the logic to look for a
proper pager in each command.

Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agoTeach git var about GIT_EDITOR
Jonathan Nieder [Thu, 12 Nov 2009 00:01:27 +0000 (18:01 -0600)]
Teach git var about GIT_EDITOR

Expose the command used by launch_editor() for scripts to use.
This should allow one to avoid searching for a proper editor
separately in each command.

git_editor(void) uses the logic to decide which editor to use
that used to live in launch_editor().  The function returns NULL
if there is no suitable editor; the caller is expected to issue
an error message when appropriate.

launch_editor() uses git_editor() and gives the error message the
same way as before when EDITOR is not set.

"git var GIT_EDITOR" gives the editor name, or an error message
when there is no appropriate one.

"git var -l" gives GIT_EDITOR=name only if there is an
appropriate editor.

Originally-submitted-by: Johannes Sixt <redacted>
Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agoSuppress warnings from "git var -l"
Jonathan Nieder [Wed, 11 Nov 2009 23:57:36 +0000 (17:57 -0600)]
Suppress warnings from "git var -l"

For scripts using "git var -l" to read all logical variables at
once, not all per-variable warnings will be relevant.  So suppress
them.

Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agoDo not use VISUAL editor on dumb terminals
Jonathan Nieder [Wed, 11 Nov 2009 23:56:07 +0000 (17:56 -0600)]
Do not use VISUAL editor on dumb terminals

Refuse to use $VISUAL and fall back to $EDITOR if TERM is unset
or set to "dumb".  Traditionally, VISUAL is set to a screen
editor and EDITOR to a line-based editor, which should be more
useful in that situation.

vim, for example, is happy to assume a terminal supports ANSI
sequences even if TERM is dumb (e.g., when running from a text
editor like Acme).  git already refuses to fall back to vi on a
dumb terminal if GIT_EDITOR, core.editor, VISUAL, and EDITOR are
unset, but without this patch, that check is suppressed by
VISUAL=vi.

Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agoUpdate packfile transfer protocol documentation
Scott Chacon [Wed, 4 Nov 2009 05:58:23 +0000 (21:58 -0800)]
Update packfile transfer protocol documentation

The current technical documentation for the packfile protocol is both
sparse and incorrect.  This documents the fetch-pack/upload-pack and
send-pack/ receive-pack protocols much more fully.

Add documentation from Shawn's upcoming http-protocol docs that is
shared by the packfile protocol. protocol-common.txt describes ABNF
notation amendments, refname rules and the packet line format.

Add documentation on the various capabilities supported by the
upload-pack and receive-pack protocols. protocol-capabilities.txt
describes multi-ack, thin-pack, side-band[-64k], shallow, no-progress,
include-tag, ofs-delta, delete-refs and report-status.

Signed-off-by: Scott Chacon <redacted>
Signed-off-by: Nanako Shiraishi <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agofilter-branch: nearest-ancestor rewriting outside subdir filter
Thomas Rast [Tue, 10 Nov 2009 21:04:51 +0000 (22:04 +0100)]
filter-branch: nearest-ancestor rewriting outside subdir filter

Since a0e4639 (filter-branch: fix ref rewriting with
--subdirectory-filter, 2008-08-12) git-filter-branch has done
nearest-ancestor rewriting when using a --subdirectory-filter.

However, that rewriting strategy is also a useful building block in
other tasks.  For example, if you want to split out a subset of files
from your history, you would typically call

  git filter-branch -- <refs> -- <files>

But this fails for all refs that do not point directly to a commit
that affects <files>, because their referenced commit will not be
rewritten and the ref remains untouched.

The code was already there for the --subdirectory-filter case, so just
introduce an option that enables it independently.

Signed-off-by: Thomas Rast <redacted>
Signed-off-by: Johannes Sixt <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agofilter-branch: stop special-casing $filter_subdir argument
Thomas Rast [Wed, 11 Nov 2009 08:53:46 +0000 (09:53 +0100)]
filter-branch: stop special-casing $filter_subdir argument

Handling $filter_subdir in the usual way requires a separate case at
every use, because the variable is empty when unused.

Furthermore, --subdirectory-filter supplies its own '--', and if the user
provided one himself, such as in

  git filter-branch --subdirectory-filter subdir -- --all -- subdir/file

an extra '--' was used as path filter in the call to git-rev-list that
determines the commits that shall be rewritten.

To keep the argument handling sane, we filter $@ to contain only the
non-revision arguments, and store all revisions in $ref_args.  The
$ref_args are easy to handle since only the SHA1s are needed; the
actual branch names have already been stored in $tempdir/heads at this
point.

An extra separating -- is only required if the user did not provide
any non-revision arguments, as the latter disambiguate the
$filter_subdir following after them (or fail earlier because they are
ambiguous themselves).

Thanks to Johannes Sixt for suggesting this solution.

Signed-off-by: Thomas Rast <redacted>
Signed-off-by: Johannes Sixt <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agoMerge branch 'maint'
Junio C Hamano [Wed, 11 Nov 2009 04:45:38 +0000 (20:45 -0800)]
Merge branch 'maint'

* maint:
  check-ref-format -h: it does not know the --print option yet

... but it does on the 'master' branch.

16 years agocheck-ref-format -h: it does not know the --print option yet
Junio C Hamano [Wed, 11 Nov 2009 04:45:23 +0000 (20:45 -0800)]
check-ref-format -h: it does not know the --print option yet

Signed-off-by: Junio C Hamano <redacted>
16 years agogit-describe.txt: formatting fix
Junio C Hamano [Tue, 10 Nov 2009 22:06:41 +0000 (14:06 -0800)]
git-describe.txt: formatting fix

A multi-line SYNOPSIS description must be marked as [verse]

Signed-off-by: Junio C Hamano <redacted>
16 years agoMerge branch 'maint'
Junio C Hamano [Tue, 10 Nov 2009 20:36:26 +0000 (12:36 -0800)]
Merge branch 'maint'

* maint:
  merge: do not setup worktree twice
  check-ref-format: update usage string

Conflicts:
builtin-check-ref-format.c

16 years agoMerge branch 'jk/maint-format-patch-p-suppress-stat'
Junio C Hamano [Tue, 10 Nov 2009 20:35:56 +0000 (12:35 -0800)]
Merge branch 'jk/maint-format-patch-p-suppress-stat'

* jk/maint-format-patch-p-suppress-stat:
  format-patch: make "-p" suppress diffstat

16 years agoMerge branch 'pb/maint-gitweb-blob-lineno'
Junio C Hamano [Tue, 10 Nov 2009 20:35:31 +0000 (12:35 -0800)]
Merge branch 'pb/maint-gitweb-blob-lineno'

* pb/maint-gitweb-blob-lineno:
  gitweb: Fix blob linenr links in pathinfo mode

16 years agoMerge branch 'tr/describe-advice'
Junio C Hamano [Tue, 10 Nov 2009 20:35:08 +0000 (12:35 -0800)]
Merge branch 'tr/describe-advice'

* tr/describe-advice:
  describe: when failing, tell the user about options that work

16 years agoMerge branch 'jk/maint-1.6.3-ls-files-i'
Junio C Hamano [Tue, 10 Nov 2009 20:33:28 +0000 (12:33 -0800)]
Merge branch 'jk/maint-1.6.3-ls-files-i'

* jk/maint-1.6.3-ls-files-i:
  ls-files: unbreak "ls-files -i"

16 years agoMerge branch 'bg/merge-ff-only'
Junio C Hamano [Tue, 10 Nov 2009 20:32:59 +0000 (12:32 -0800)]
Merge branch 'bg/merge-ff-only'

* bg/merge-ff-only:
  Teach 'git merge' and 'git pull' the option --ff-only

16 years agoMerge branch 'vl/maint-openssl-signature-change'
Junio C Hamano [Tue, 10 Nov 2009 20:32:18 +0000 (12:32 -0800)]
Merge branch 'vl/maint-openssl-signature-change'

* vl/maint-openssl-signature-change:
  imap-send.c: fix compiler warnings for OpenSSL 1.0

16 years agoMerge branch 'jk/maint-push-config'
Junio C Hamano [Tue, 10 Nov 2009 20:31:42 +0000 (12:31 -0800)]
Merge branch 'jk/maint-push-config'

* jk/maint-push-config:
  push: always load default config

16 years agoMerge branch 'jk/gitignore-anchored'
Junio C Hamano [Tue, 10 Nov 2009 20:31:11 +0000 (12:31 -0800)]
Merge branch 'jk/gitignore-anchored'

* jk/gitignore-anchored:
  gitignore: root most patterns at the top-level directory

Conflicts:
.gitignore

16 years agoMerge branch 'jp/dirty-describe'
Junio C Hamano [Tue, 10 Nov 2009 20:30:43 +0000 (12:30 -0800)]
Merge branch 'jp/dirty-describe'

* jp/dirty-describe:
  Teach "git describe" --dirty option

16 years agoMerge branch 'sr/blame-incomplete'
Junio C Hamano [Tue, 10 Nov 2009 20:29:53 +0000 (12:29 -0800)]
Merge branch 'sr/blame-incomplete'

* sr/blame-incomplete:
  blame: make sure that the last line ends in an LF

16 years agodiff --no-index: make the usage string less scary
Jonathan Nieder [Mon, 9 Nov 2009 15:05:04 +0000 (09:05 -0600)]
diff --no-index: make the usage string less scary

Start the diff --no-index usage string with "usage:" instead of
"fatal:".

Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agomerge-{recursive,subtree}: use usagef() to print usage
Jonathan Nieder [Mon, 9 Nov 2009 15:05:03 +0000 (09:05 -0600)]
merge-{recursive,subtree}: use usagef() to print usage

Usage messages (for example, from "git merge-recursive -h") are
friendlier when not preceded by "fatal".

Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agoIntroduce usagef() that takes a printf-style format
Jonathan Nieder [Mon, 9 Nov 2009 15:05:02 +0000 (09:05 -0600)]
Introduce usagef() that takes a printf-style format

Some new callers would want to use printf-like formatting, when issuing
their usage messages.  An option is to change usage() itself also be like
printf(), which would make it similar to die() and warn().

But usage() is typically fixed, as opposed to die() and warn() that gives
diagnostics depending on the situation.  Indeed, the majority of strings
given by existing callsites to usage() are fixed strings.  If we were to
make usage() take printf-style format, they all need to be changed to have
"%s" as their first argument.

So instead, introduce usagef() so that limited number of callers can use
it.

Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agoLet 'git <command> -h' show usage without a git dir
Jonathan Nieder [Mon, 9 Nov 2009 15:05:01 +0000 (09:05 -0600)]
Let 'git <command> -h' show usage without a git dir

There is no need for "git <command> -h" to depend on being inside
a repository.

Reported by Gerfried Fuchs through http://bugs.debian.org/462557

Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agoShow usage string for 'git http-push -h'
Jonathan Nieder [Mon, 9 Nov 2009 10:47:34 +0000 (04:47 -0600)]
Show usage string for 'git http-push -h'

http-push already knows how to dump usage if it is given no options, but
it interprets '-h' as the URL to a remote repository:

    $ git http-push -h
    error: Cannot access URL -h/, return code 6

Dump usage instead.  Humans wanting to pass the URL -h/ to curl for some
reason can use 'git http-push -h/' explicitly.  Scripts expecting to
access an HTTP repository at URL '-h' will break, though.

Also delay finding a git directory until after option parsing, so
"http-push -h" can be used outside any git repository.

Signed-off-by: Jonathan Nieder <redacted>
Acked-by: Tay Ray Chuan <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agoformat-patch: Add "--no-stat" as a synonym for "-p"
Björn Gustavsson [Sat, 7 Nov 2009 09:58:55 +0000 (10:58 +0100)]
format-patch: Add "--no-stat" as a synonym for "-p"

"-p" means "generate patch" in 'git log' and 'git diff', so it's
quite surprising that it means "suppress diffstat" in
'git format-patch'.

Keep the "-p" option for backward compatibility, but add
"--no-stat" as a more intuitive synonym. For backward compatibility
with scripts, we must allow combinations of --stat and --no-stat.

Signed-off-by: Björn Gustavsson <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agoformat-patch documentation: Fix formatting
Björn Gustavsson [Sat, 7 Nov 2009 09:53:07 +0000 (10:53 +0100)]
format-patch documentation: Fix formatting

Format git commands and options consistently using back quotes
(i.e. a fixed font in the resulting HTML document).

Signed-off-by: Björn Gustavsson <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agoformat-patch documentation: Remove diff options that are not useful
Björn Gustavsson [Sat, 7 Nov 2009 09:52:29 +0000 (10:52 +0100)]
format-patch documentation: Remove diff options that are not useful

To simplify reading the documentation for format-patch, remove the
description of common diff options that are not useful for the
purpose of the command (i.e. "Prepare patches for e-mail submission").

Specifically, this removes the description of the following options:

  --raw
  -z
  --color
  --no-color
  --color-words
  --diff-filter
  -S
  --pickaxe-all
  --pickaxe-regex
  -R
  --relative
  --exit-code
  --quiet

Signed-off-by: Björn Gustavsson <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agoformat-patch: Always generate a patch
Björn Gustavsson [Sat, 7 Nov 2009 09:51:56 +0000 (10:51 +0100)]
format-patch: Always generate a patch

Jeff King recently reinstated -p to suppress the default diffstat
(as -p used to work before 68daa64, about 14 months ago).

However, -p is also needed in combination with certain options
(e.g. --stat or --numstat) in order to produce any patch at all.
The documentation does not mention this.

Since the purpose of format-patch is to produce a patch that
can be emailed, it does not make sense that certain combination
of options will suppress the generation of the patch itself.

Therefore:

* Update 'git format-patch' to always generate a patch.

* Since the --name-only, --name-status, and --check suppresses
  the generation of the patch, disallow those options,
  and remove the description of them in the documentation.

* Remove the reference to -p in the description of -U.

* Remove the descriptions of the options that are synonyms for -p
  plus another option (--patch-with-raw and --patch-with-stat).

* While at it, slightly tweak the description of -p itself
  to say that it generates "plain patches", so that you can
  think of -p as "plain patch" as an mnemonic aid.

Signed-off-by: Björn Gustavsson <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agoLet 'git http-fetch -h' show usage outside any git repository
Jonathan Nieder [Mon, 9 Nov 2009 15:04:59 +0000 (09:04 -0600)]
Let 'git http-fetch -h' show usage outside any git repository

Delay search for a git directory until option parsing has finished.
None of the functions used in option parsing look for or read any
files other than stdin, so this is safe.

Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agoMerge branch 'jn/maint-http-fetch-mingw' into jn/help-everywhere
Junio C Hamano [Tue, 10 Nov 2009 19:10:14 +0000 (11:10 -0800)]
Merge branch 'jn/maint-http-fetch-mingw' into jn/help-everywhere

* jn/maint-http-fetch-mingw:
  http-fetch: add missing initialization of argv0_path
  merge: do not setup worktree twice
  check-ref-format: update usage string

Conflicts:
builtin-check-ref-format.c

16 years agoShow usage string for 'git stripspace -h'
Jonathan Nieder [Mon, 9 Nov 2009 15:04:57 +0000 (09:04 -0600)]
Show usage string for 'git stripspace -h'

Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agoShow usage string for 'git unpack-file -h'
Jonathan Nieder [Mon, 9 Nov 2009 15:04:56 +0000 (09:04 -0600)]
Show usage string for 'git unpack-file -h'

"unpack-file -h" could be asking to save the contents of a blob
named "-h".  Strictly speaking, such a pathological ref name is
possible, but the user would have to had said something like
"tags/-h" to name such a pathological ref already.  When used in
scripts, unpack-file is typically not passed a user-supplied tag
name directly.

Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agoShow usage string for 'git show-index -h'
Jonathan Nieder [Mon, 9 Nov 2009 15:04:55 +0000 (09:04 -0600)]
Show usage string for 'git show-index -h'

Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agoShow usage string for 'git rev-parse -h'
Jonathan Nieder [Mon, 9 Nov 2009 15:04:54 +0000 (09:04 -0600)]
Show usage string for 'git rev-parse -h'

Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agoShow usage string for 'git merge-one-file -h'
Jonathan Nieder [Mon, 9 Nov 2009 15:04:53 +0000 (09:04 -0600)]
Show usage string for 'git merge-one-file -h'

Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agoShow usage string for 'git mailsplit -h'
Jonathan Nieder [Mon, 9 Nov 2009 15:04:52 +0000 (09:04 -0600)]
Show usage string for 'git mailsplit -h'

Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agoShow usage string for 'git imap-send -h'
Jonathan Nieder [Mon, 9 Nov 2009 15:04:51 +0000 (09:04 -0600)]
Show usage string for 'git imap-send -h'

Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agoShow usage string for 'git get-tar-commit-id -h'
Jonathan Nieder [Mon, 9 Nov 2009 15:04:50 +0000 (09:04 -0600)]
Show usage string for 'git get-tar-commit-id -h'

Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agoShow usage string for 'git fast-import -h'
Jonathan Nieder [Mon, 9 Nov 2009 15:04:49 +0000 (09:04 -0600)]
Show usage string for 'git fast-import -h'

Let "git fast-import -h" (with no other arguments) print usage
before exiting, even when run outside any repository.

Cc: Shawn O. Pearce <redacted>
Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agoShow usage string for 'git check-ref-format -h'
Jonathan Nieder [Mon, 9 Nov 2009 15:04:48 +0000 (09:04 -0600)]
Show usage string for 'git check-ref-format -h'

This only changes the behavior of "git check-ref-format -h"
without any other options and arguments.

This change cannot be breaking backward compatibility, since any
valid refname must contain a /.   Most existing scripts use
arguments such as "heads/$foo".  If some script checks the
refname "-h" alone, git check-ref-format will still exit with
nonzero status, and the only detrimental side-effect will be a
usage string sent to stderr.

Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agohttp-fetch: add missing initialization of argv0_path
Jonathan Nieder [Mon, 9 Nov 2009 15:05:00 +0000 (09:05 -0600)]
http-fetch: add missing initialization of argv0_path

According to c6dfb39 (remote-curl: add missing initialization of
argv0_path, 2009-10-13), programs with "main" must call this to
work correctly on MinGW.

Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agomerge: do not setup worktree twice
Jonathan Nieder [Mon, 9 Nov 2009 15:04:58 +0000 (09:04 -0600)]
merge: do not setup worktree twice

Builtins do not need to run setup_worktree() for themselves, since
the builtin machinery runs it for them.

Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agocheck-ref-format: update usage string
Jonathan Nieder [Mon, 9 Nov 2009 15:04:47 +0000 (09:04 -0600)]
check-ref-format: update usage string

'git check-ref-format' has learned --branch and --print options
since the usage string was last updated.

Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agogit-update-index.txt: Document the --really-refresh option.
Štěpán Němec [Tue, 10 Nov 2009 18:11:51 +0000 (19:11 +0100)]
git-update-index.txt: Document the --really-refresh option.

Add the description next to --assume-unchanged because this option is only
useful in a special case of using that option.

Signed-off-by: Štěpán Němec <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agoRe-implement 'git remote update' using 'git fetch'
Björn Gustavsson [Tue, 10 Nov 2009 08:21:32 +0000 (09:21 +0100)]
Re-implement 'git remote update' using 'git fetch'

In order not to duplicate functionality, re-implement 'git remote
update' in terms of 'git fetch'.

Signed-off-by: Björn Gustavsson <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agobuiltin-fetch: add --dry-run option
Jay Soffian [Tue, 10 Nov 2009 08:19:43 +0000 (09:19 +0100)]
builtin-fetch: add --dry-run option

Teach fetch --dry-run as users of "git remote prune" switching to "git fetch
--prune" may expect it. Unfortunately OPT__DRY_RUN() cannot be used as fetch
already uses "-n" for something else.

Signed-off-by: Jay Soffian <redacted>
Signed-off-by: Björn Gustavsson <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agobuiltin-fetch: add --prune option
Jay Soffian [Tue, 10 Nov 2009 08:15:47 +0000 (09:15 +0100)]
builtin-fetch: add --prune option

Teach fetch to cull stale remote tracking branches after fetching via --prune.

Signed-off-by: Jay Soffian <redacted>
Signed-off-by: Björn Gustavsson <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agoteach warn_dangling_symref to take a FILE argument
Jay Soffian [Tue, 10 Nov 2009 05:03:32 +0000 (00:03 -0500)]
teach warn_dangling_symref to take a FILE argument

Different callers of warn_dangling_symref() may want to control whether its
output goes to stdout or stderr so let it take a FILE argument.

Signed-off-by: Jay Soffian <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agoremote: refactor some logic into get_stale_heads()
Jay Soffian [Tue, 10 Nov 2009 05:03:31 +0000 (00:03 -0500)]
remote: refactor some logic into get_stale_heads()

Move the logic in builtin-remote.c which determines which local heads are stale
to remote.c so it can be used by other builtins.

Signed-off-by: Jay Soffian <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agoAdd missing test for 'git remote update --prune'
Björn Gustavsson [Mon, 9 Nov 2009 20:11:59 +0000 (21:11 +0100)]
Add missing test for 'git remote update --prune'

Signed-off-by: Björn Gustavsson <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agoAdd the configuration option skipFetchAll
Björn Gustavsson [Mon, 9 Nov 2009 20:11:06 +0000 (21:11 +0100)]
Add the configuration option skipFetchAll

Implement the configuration skipFetchAll option to allow
certain remotes to be skipped when doing 'git fetch --all' and
'git remote update'. The existing skipDefaultUpdate variable
is still honored (by 'git fetch --all' and 'git remote update').
(If both are set in the configuration file with different values,
the value of the last occurrence will be used.)

Signed-off-by: Björn Gustavsson <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agoTeach the --multiple option to 'git fetch'
Björn Gustavsson [Mon, 9 Nov 2009 20:10:32 +0000 (21:10 +0100)]
Teach the --multiple option to 'git fetch'

Add the --multiple option to specify that all arguments are either
groups or remotes. The primary reason for adding this option is
to allow us to re-implement 'git remote update' using fetch.

It would have been nice if this option was not needed, but since
the colon in a refspec is optional, it is in general not possible
to know whether a single, colon-less argument is a remote or a
refspec.

Signed-off-by: Björn Gustavsson <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agoTeach the --all option to 'git fetch'
Björn Gustavsson [Mon, 9 Nov 2009 20:09:56 +0000 (21:09 +0100)]
Teach the --all option to 'git fetch'

'git remote' is meant for managing remotes and 'git fetch' is meant
for actually fetching data from remote repositories. Therefore, it is
not logical that you must use 'git remote update' to fetch from
more than one repository at once.

Add the --all option to 'git fetch', to tell it to attempt to fetch
from all remotes. Also, if --all is not given, the <repository>
argument is allowed to be the name of a group, to allow fetching
from all repositories in the group.

Other options except -v and -q are silently ignored.

Signed-off-by: Björn Gustavsson <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agoShow usage string for 'git show-ref -h'
Jonathan Nieder [Mon, 9 Nov 2009 15:04:46 +0000 (09:04 -0600)]
Show usage string for 'git show-ref -h'

This only changes the behavior of "git show-ref -h" without any
other options and arguments.

"show-ref -h" currently is short for "show-ref --head", which
shows all the refs/* and HEAD, as opposed to "show-ref" that
shows all the refs/* and not HEAD.

Does anybody use "show-ref -h"?  It was in Linus's original, most
likely only because "it might be handy", not because "the command
should not show the HEAD by default for such and such reasons".
So I think it is okay if "show-ref -h" (but not "show-ref
--head") gives help and exits.

If a current script uses "git show-ref -h" without any other
arguments, it would have to be adapted by changing "-h" to
"--head".

Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agoShow usage string for 'git merge-ours -h'
Jonathan Nieder [Mon, 9 Nov 2009 15:04:45 +0000 (09:04 -0600)]
Show usage string for 'git merge-ours -h'

This change is strictly about 'git merge-ours -h' without
any other options and arguments.

This change cannot break compatibility since merge drivers are
always passed '--', among other arguments.

Any usage string for this command is a lie, since it ignored its
arguments until now.  Still, it makes sense to let the user know
the expected usage when asked.

Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agoShow usage string for 'git commit-tree -h'
Jonathan Nieder [Mon, 9 Nov 2009 15:04:44 +0000 (09:04 -0600)]
Show usage string for 'git commit-tree -h'

Treat an "-h" option as a request for help, rather than a "Not a
valid object name" error.

"commit-tree -h" could be asking to create a new commit from a
treeish named "-h".  Strictly speaking, such a pathological ref
name is possible, but the user would have to had said something
like "tags/-h" to name such a pathological already.  commit-tree
is usually used in scripts with raw object ids, anyway.

For consistency, the "-h" option uses its new meaning even if
followed by other arguments.

Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agoShow usage string for 'git cherry -h'
Jonathan Nieder [Mon, 9 Nov 2009 15:04:43 +0000 (09:04 -0600)]
Show usage string for 'git cherry -h'

Treat an "-h" option as a request for help, rather than an
"Unknown commit -h" error.

"cherry -h" could be asking to compare histories that leads to
our HEAD and a commit that can be named as "-h".  Strictly
speaking, that may be a valid refname, but the user would have to
say something like "tags/-h" to name such a pathological ref
already, so it is not such a big deal.

The "-h" option keeps its meaning even if preceded by other
options or followed by other arguments.  This keeps the
command-line syntax closer to what parse_options would give and
supports shell aliases like 'alias cherry="git cherry -v"' a
little better.

Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agoShow usage string for 'git grep -h'
Jonathan Nieder [Mon, 9 Nov 2009 15:04:42 +0000 (09:04 -0600)]
Show usage string for 'git grep -h'

Clarification: the following description only talks about "git
grep -h" without any other options and arguments.

Such a change cannot be breaking backward compatibility.  "grep
-h" cannot be asking for suppressing filenames, as there is no
match pattern specified.

Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agoRetire fetch--tool helper to contrib/examples
Jonathan Nieder [Mon, 9 Nov 2009 15:04:41 +0000 (09:04 -0600)]
Retire fetch--tool helper to contrib/examples

When git-fetch was builtin-ized, the previous script was moved to
contrib/examples.  Now, it is the sole remaining user for
'git fetch--tool'.

The fetch--tool code is still worth keeping around so people can
try out the old git-fetch.sh, for example when investigating
regressions from the builtinifaction.

Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agot5551-http-fetch: Work around broken Accept header in libcurl
Shawn O. Pearce [Mon, 9 Nov 2009 18:10:37 +0000 (10:10 -0800)]
t5551-http-fetch: Work around broken Accept header in libcurl

Unfortunately at least one version of libcurl has a bug causing
it to include "Accept: */*" in the same POST request where we have
already asked for "Accept: application/x-git-upload-pack-response".

This is a bug in libcurl, not Git, or our test vector.  The
application has explicitly asked the server for a single content
type, but libcurl has mistakenly also told the server the client
application will accept */*, which is any content type.

Based on the libcurl change log, this "Accept: */*" header bug
may have been fixed in version 7.18.1 released March 30, 2008:

  http://curl.haxx.se/changes.html#7_18_1

Rather than require users to upgrade libcurl we change the test
vector to trim this line out of the 2nd request.

Reported-by: Tarmigan <redacted>
Signed-off-by: Shawn O. Pearce <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agot5551-http-fetch: Work around some libcurl versions
Shawn O. Pearce [Mon, 9 Nov 2009 18:10:36 +0000 (10:10 -0800)]
t5551-http-fetch: Work around some libcurl versions

Some versions of libcurl report their output when GIT_CURL_VERBOSE
is set differently than other versions do.  At least one variant
(version unknown but likely pre-7.18.1) reports the POST payload to
stderr, and omits the blank line after each HTTP request/response.
We clip these lines out of the stderr output now before doing the
compare, so we aren't surprised by this trivial difference.

Reported-by: Tarmigan <redacted>
Signed-off-by: Shawn O. Pearce <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agohttp-backend: Protect GIT_PROJECT_ROOT from /../ requests
Shawn O. Pearce [Mon, 9 Nov 2009 19:26:43 +0000 (11:26 -0800)]
http-backend: Protect GIT_PROJECT_ROOT from /../ requests

Eons ago HPA taught git-daemon how to protect itself from /../
attacks, which Junio brought back into service in d79374c7b58d
("daemon.c and path.enter_repo(): revamp path validation").

I did not carry this into git-http-backend as originally we relied
only upon PATH_TRANSLATED, and assumed the HTTP server had done
its access control checks to validate the resolved path was within
a directory permitting access from the remote client.  This would
usually be sufficient to protect a server from requests for its
/etc/passwd file by http://host/smart/../etc/passwd sorts of URLs.

However in 917adc036086 Mark Lodato added GIT_PROJECT_ROOT as an
additional method of configuring the CGI.  When this environment
variable is used the web server does not generate the final access
path and therefore may blindly pass through "/../etc/passwd"
in PATH_INFO under the assumption that "/../" might have special
meaning to the invoked CGI.

Instead of permitting these sorts of malformed path requests, we
now reject them back at the client, with an error message for the
server log.  This matches git-daemon behavior.

Signed-off-by: Shawn O. Pearce <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agoGit-aware CGI to provide dumb HTTP transport
Shawn O. Pearce [Mon, 9 Nov 2009 15:24:33 +0000 (07:24 -0800)]
Git-aware CGI to provide dumb HTTP transport

http-backend: Fix symbol clash on AIX 5.3

Mike says:

 > > +static void send_file(const char *the_type, const char *name)
 > > +{
 >
 > I think a symbol clash here is responsible for a build breakage in
 > next on AIX 5.3:
 >
 > CC http-backend.o
 > http-backend.c:213: error: conflicting types for `send_file'
 > /usr/include/sys/socket.h:676: error: previous declaration of `send_file'
 > gmake: *** [http-backend.o] Error 1

So we rename the function send_local_file().

Reported-by: Mike Ralphson <redacted>
Signed-off-by: Shawn O. Pearce <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agogitweb: Smarter snapshot names
Mark Rada [Sat, 7 Nov 2009 15:13:29 +0000 (16:13 +0100)]
gitweb: Smarter snapshot names

Teach gitweb how to produce nicer snapshot names by only using the
short hash id.  If clients make requests using a tree-ish that is not
a partial or full SHA-1 hash, then the short hash will also be appended
to whatever they asked for.  If clients request snapshot of a tag
(which means that $hash ('h') parameter has 'refs/tags/' prefix),
use only tag name.

Update tests cases in t9502-gitweb-standalone-parse-output.

Gitweb uses the following format for snapshot filenames:
  <sanitized project name>-<version info>.<snapshot suffix>
where <sanitized project name> is project name with '.git' or '/.git'
suffix stripped, unless '.git' is the whole project name.  For
snapshot prefix it uses:
  <sanitized project name>-<version info>/
as compared to <sanitized project name>/ before (without version info).

Current rules for <version info>:
* if 'h' / $hash parameter is SHA-1 or shortened SHA-1, use SHA-1
  shortened to to 7 characters
* otherwise if 'h' / $hash parameter is tag name (it begins with
  'refs/tags/' prefix, use tag name (with 'refs/tags/' stripped
* otherwise if 'h' / $hash parameter starts with 'refs/heads/' prefix,
  strip this prefix, convert '/' into '.', and append shortened SHA-1
  after '-', i.e. use <sanitized hash>-<shortened sha1>

Signed-off-by: Mark Rada <redacted>
Signed-off-by: Shawn O. Pearce <redacted>
Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agogitweb: Document current snapshot rules via new tests
Jakub Narebski [Sat, 7 Nov 2009 15:13:28 +0000 (16:13 +0100)]
gitweb: Document current snapshot rules via new tests

Add t9502-gitweb-standalone-parse-output test script, which runs
gitweb as a CGI script from the commandline and checks that it
produces the correct output.

Currently this test script contains only tests of snapshot naming
(proposed name of snapshot file) and snapshot prefix (prefix of files
in the archive / snapshot).  It defines and uses 'tar' snapshot
format, without compression, for easy checking of snapshot prefix.
Testing is done using check_snapshot function.

Gitweb uses the following format for snapshot filenames:
  <sanitized project name>-<hash parameter><snapshot suffix>
where <sanitized project name> is project name with '.git' or '/.git'
suffix stripped, unless '.git' is the whole project name.  For
snapshot prefix it uses simply:
  <sanitized project name>/

Disadvantages of current snapshot rules:
* There exists convention that <basename>.<suffix> archive unpacks to
  <basename>/ directory (<basename>/ is prefix of archive).  Gitweb
  does not respect it
* Snapshot links generated by gitweb use full SHA-1 id as a value of
  'h' / $hash parameter.  With current rules it leads to long file
  names like e.g. repo-1005c80cc11c531d327b12195027cbbb4ff9e3cb.tgz
* For handcrafted URLs, where 'h' / $hash parameter is a symbolic
  'volatile' revision name such as "HEAD" or "next" snapshot name
  doesn't tell us what exact version it was created from
* Proposed filename in Content-Disposition header should not contain
  any directory path information, which means that it should not
  contain '/' (see RFC2183)... which means that snapshot naming is
  broken for $hash being e.g. hirearchical branch name such as
  'xx/test'

This would be improved in next commit.

Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agoDocumentation: add "Fighting regressions with git bisect" article
Christian Couder [Sun, 8 Nov 2009 15:09:47 +0000 (16:09 +0100)]
Documentation: add "Fighting regressions with git bisect" article

This patch adds an asciidoc version of the "Fighting regressions with
git bisect" article that the author wrote for the Linux-Kongress
2009 (http://www.linux-kongress.org/2009).

This paper might be interesting to people who want to learn as much as
possible about "git bisect" from a single document.

The slides of the related presentation are available at:

http://www.linux-kongress.org/2009/slides/fighting_regressions_with_git_bisect_christian_couder.pdf

But the Linux Kongress people will not publish this paper online because
they print the papers on their UpTimes magazine
(http://www.lob.de/isbn/978-3-86541-358-1). But they don't take away the
rights of the author (which is very nice), so I have the right to publish
it.

Signed-off-by: Christian Couder <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agoMerge branch 'maint'
Junio C Hamano [Mon, 9 Nov 2009 02:16:04 +0000 (18:16 -0800)]
Merge branch 'maint'

* maint:
  Add intermediate build products to .gitignore

16 years agoMSVC: Add support for building with NO_MMAP
Ramsay Jones [Sat, 7 Nov 2009 20:10:31 +0000 (20:10 +0000)]
MSVC: Add support for building with NO_MMAP

When the NO_MMAP build variable is set, the msvc linker complains:

    error LNK2001: unresolved external symbol _getpagesize

The msvc libraries do not define the getpagesize() function,
so we move the mingw_getpagesize() implementation from the
conditionally built win32mmap.c file to mingw.c.

Signed-off-by: Ramsay Jones <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agoMakefile: keep MSVC and Cygwin configuration separate
Ramsay Jones [Sat, 7 Nov 2009 20:08:01 +0000 (20:08 +0000)]
Makefile: keep MSVC and Cygwin configuration separate

Signed-off-by: Ramsay Jones <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agoMakefile: merge two Cygwin configuration sections into one
Ramsay Jones [Tue, 27 Oct 2009 19:11:55 +0000 (19:11 +0000)]
Makefile: merge two Cygwin configuration sections into one

Signed-off-by: Ramsay Jones <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agoAdd intermediate build products to .gitignore
Jonathan Nieder [Sun, 8 Nov 2009 22:07:16 +0000 (16:07 -0600)]
Add intermediate build products to .gitignore

Temporaries such as configure.ac+ and Documentation/*.xml+
sometimes remain after an interrupted build.  Tell git not to
track them.

Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agoformat-patch: make "-p" suppress diffstat
Jeff King [Wed, 4 Nov 2009 07:19:40 +0000 (02:19 -0500)]
format-patch: make "-p" suppress diffstat

Once upon a time, format-patch would use its default stat
plus patch format only when no diff format was given on the
command line. This meant that "format-patch -p" would
suppress the stat and show just the patch.

Commit 68daa64 changed this to keep the stat format when we
had an "implicit" patch format, like "-U5". As a side
effect, this meant that an explicit patch format was now
ignored (because cmd_format_patch didn't know the reason
that the format was set way down in diff_opt_parse).

This patch unbreaks what 68daa64 did (while still preserving
what 68daa64 was trying to do), reinstating "-p" to suppress
the default behavior. We do this by parsing "-p" ourselves
in format-patch, and noting whether it was used explicitly.

Signed-off-by: Jeff King <redacted>
Signed-off-by: Junio C Hamano <redacted>
16 years agolog --format: don't ignore %w() at the start of format string
René Scharfe [Sun, 8 Nov 2009 01:04:21 +0000 (02:04 +0100)]
log --format: don't ignore %w() at the start of format string

This fixes e.g. --format='%w(72)%s'.

Signed-off-by: Rene Scharfe <redacted>
Signed-off-by: Junio C Hamano <redacted>
git clone https://git.99rst.org/PROJECT