Makefile: fold XDIFF_H and VCSSVN_H into LIB_H

Just like MISC_H (see previous commit), there is no reason to track
xdiff and vcs-svn headers separately from the rest of the headers.
The only purpose of these variables is to keep track of recompilation
dependencies.

As a pleasant side effect, folding these into LIB_H lets us stop
tracking GIT_OBJS and VCSSVN_TEST_OBJS separately from the list of all
OBJECTS.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Makefile: do not have git.o depend on common-cmds.h

This dependency has been stale since 70827b1 (Split up
builtin commands into separate files from git.c, 2006-04-21).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Makefile: apply dependencies consistently to sparse/asm targets

When a C file "foo.c" depends on a generated header file, we
note the dependency for the "foo.o" target. However, we
should also note it for other targets that are built from
foo.c, like "foo.sp" and "foo.s". These tend to be missed
because the latter two are not part of the default build,
and are typically built after a regular build which will
generate the header.  Let's be consistent about including
them in dependencies.

This also makes us more consistent with nearby lines which
tack on EXTRA_CPPFLAGS when building certain files.  These
flags may sometimes require extra dependencies to be added
(e.g., like GIT-VERSION-FILE; this is not the case for any
of the updated lines in this patch, but it is establishing a
style that will be used in later patches). Technically the
".sp" and ".s" targets do not care about these dependencies,
because they are force-built (".sp" because it is a phony
target, and ".s" because we explicitly force a rebuild).

Since the blocks in question are about communicating "things
built from foo.c depend on these flags", it frees the reader
from having to know or care more about how those targets are
implemented, and why it is OK for only "foo.o" to depend on
GIT-VERSION-FILE while "foo.sp" and "foo.s" both are
impacted by $(GIT_VERSION). And it helps future-proof us if
those force-build details should ever change.

This patch explicitly does not update the static header
dependencies used when COMPUTED_HEADER_DEPENDENCIES is off.
They are similar to the GIT-VERSION-FILE case above, in that
technically "foo.s" would depend on its included headers,
but it is irrelevant because we force-build it anyway. So it
would be tempting to update them in the same way (for
readability and future-proofing). However, those rules are
meant as a fallback to the computed header dependencies,
which do not handle ".s" and ".sp" at all (and are a much
harder problem to solve, as gcc is the one generating those
dependency lists).

So let's leave that harder problem until (and if) somebody
wants to change the ".sp" and ".s" rules, and keep the
static header dependencies consistent with the computed
ones.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Makefile: do not replace @@GIT_USER_AGENT@@ in scripts

No scripts actually care about this replacement. This was
erroneously added by 42dcbb7 (version: add git_user_agent function,
2012-06-02).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Makefile: split GIT_USER_AGENT from GIT-CFLAGS

The default user-agent depends on the GIT_VERSION, which
means that anytime you switch versions, it causes a full
rebuild. Instead, let's split it out into its own file and
restrict the dependency to version.o.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Makefile: be silent when only GIT_USER_AGENT changes

To avoid noise during builds, unlike the GIT-CFLAGS rule which prints
"* new build flags or prefix" so the operator knows why all files are
being rebuilt when it changes, GIT-USER-AGENT generation is silent.

If this code breaks and a target depending on GIT-USER-AGENT ends up
being rebuilt when it shouldn't be, the full dependency chain can be
retrieved with "make --debug=b".

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Makefile: split prefix flags from GIT-CFLAGS

Most of the build targets do not care about the setting of
$prefix (or its derivative variables), but will be rebuilt
if the prefix changes. For most setups this doesn't matter
(they set prefix once and never change it), but for a setup
which puts each branch or version in its own prefix, this
unnecessarily causes a full rebuild whenever the branc is
changed.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Makefile: do not replace @@GIT_VERSION@@ in shell scripts

No shell script actually uses the replacement (it is used in
some perl scripts, but cmd_munge_script only handles shell
scripts). We can also therefore drop the dependency on
GIT-VERSION-FILE.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Makefile: update scripts when build-time parameters change

Currently, running:

  make SHELL_PATH=/bin/bash &&
  make SHELL_PATH=/bin/sh

will not rebuild any shell scripts in the second command,
leading to incorrect results when building from an unclean
working directory.

This patch introduces a new dependency meta-file to notice
the change.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Makefile: build instaweb similar to other scripts

Instaweb would not properly rebuild if the build-time
parameters changed. Fix this by depending on the
GIT-SCRIPT-DEFINES meta-file and using $(cmd_munge_script)
like all the other shell scripts. This requires adding a few
new parametres to cmd_munge_script, but that doesn't hurt
existing scripts.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Makefile: move GIT-VERSION-FILE dependencies closer to use

There is a list of all of the targets which depend on
GIT-VERSION-FILE, but it can be quite far from the actual
point where the targets actually use $(GIT_VERSION). This
can make it hard to verify that each use of $(GIT_VERSION)
has a matching dependency.

This patch moves the dependency closer to the actual build
instructions, which makes verification easier.  This also
fixes the generation of "configure", which did not properly
mark the dependency.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Makefile: document ground rules for target-specific dependencies

When a source file makes use of a makefile variable, there should be a
corresponding dependency on a file that changes when that variable
changes to ensure the build output is not left stale when the variable
changes.

Document this, even though we are not following the rule perfectly
yet.  Based on an explanation from Jeff King.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Merge branch 'mm/push-default-switch-warning' into jch

Will defer for another cycle.

# By Matthieu Moy
* mm/push-default-switch-warning:
  push: start warning upcoming default change for push.default
Merge branch 'cw/rebase-i-root' into jch

"git rebase [-i] --root $tip" can now be used to rewrite all the
history down to the root.

* cw/rebase-i-root:
  t3404: make test 57 work with dash and others
  Add tests for rebase -i --root without --onto
  rebase -i: support --root without --onto

Conflicts:
	Documentation/git-rebase.txt
	git-rebase.sh
	t/t3404-rebase-interactive.sh
Merge branch 'mz/rebase-no-mbox' into jch

Teach "am --rebasing" codepath to grab authorship, log message and
the patch text directly out of existing commits.  This will help
rebasing commits that have confusing "diff" output in their log
messages.

Will merge to 'master'.

* mz/rebase-no-mbox:
  am: don't call mailinfo if $rebasing
  am --rebasing: get patch body from commit, not from mailbox
  rebase --root: print usage on too many args
  rebase: don't source git-sh-setup twice

Conflicts:
	t/t3412-rebase-root.sh
Merge branch 'mm/mediawiki-file-attachments' into jch

"mediawiki" remote helper (in contrib/) learned to handle file
attachments.

Will merge to 'master'.

# By Matthieu Moy (4) and others
* mm/mediawiki-file-attachments:
  git-remote-mediawiki: improve support for non-English Wikis
  git-remote-mediawiki: import "File:" attachments
  git-remote-mediawiki: split get_mw_pages into smaller functions
  git-remote-mediawiki: send "File:" attachments to a remote wiki
  git-remote-mediawiki: don't "use encoding 'utf8';"
  git-remote-mediawiki: don't compute the diff when getting commit message
Merge branch 'jc/refactor-diff-stdin' into jch

Due to the way "git diff --no-index" is bolted onto by touching the
low level code that is shared with the rest of the "git diff" code,
even though it has to work in a very different way, any comparison
that involves a file "-" at the root level incorrectly tried to read
from the standard input.  This cleans up the no-index codepath
further to remove code that reads from the standard input from the
core side, which is never necessary when git is running its usual
diff operation.

Will merge to 'next', and later down to older maintenance releases.

* jc/refactor-diff-stdin:
  diff-index.c: "git diff" has no need to read blob from the standard input
  diff-index.c: unify handling of command line paths
  diff-index.c: do not pretend paths are pathspecs

Conflicts:
	diff-no-index.c
Merge branch 'tr/maint-show-walk' into jch

Fixes "git show"'s auto-walking behaviour, and make it behave just
like "git log" does when it walks.

Note that this is different from Thomas's patch.

Will merge to 'next'.

# By Junio C Hamano (1) and Thomas Rast (1)
* tr/maint-show-walk:
  show: fix "range implies walking"
  Demonstrate git-show is broken with ranges
Merge branch 'jk/push-delete-ref-error-message' into jch

The error message from "git push $there :bogo" mentioned we tried
and failed to guess what ref is being deleted based on the LHS of
the refspec, which we don't.

Will merge to 'next'.

# By Jeff King
* jk/push-delete-ref-error-message:
  push: don't guess at qualifying remote refs on deletion
Merge branch 'jn/vcs-svn' into jch

Reroll of db/vcs-svn.

Will merge to 'next' and soon to 'master'.

* jn/vcs-svn:
  vcs-svn: allow 64-bit Prop-Content-Length
  vcs-svn: suppress a signed/unsigned comparison warning
  vcs-svn: suppress a signed/unsigned comparison warning
  vcs-svn: suppress signed/unsigned comparison warnings
  vcs-svn: use strstr instead of memmem
  vcs-svn: use constcmp instead of prefixcmp
  vcs-svn: simplify cleanup in apply_one_window
  vcs-svn: avoid self-assignment in dummy initialization of pre_off
  vcs-svn: drop no-op reset methods
  vcs-svn: suppress -Wtype-limits warning
  vcs-svn: allow import of > 4GiB files
  vcs-svn: rename check_overflow and its arguments for clarity

Conflicts:
	vcs-svn/svndump.c