t/test.sh: add "-a" to ls invocation when testing for .bup exclusion.

The bup-exclude test seems be to checking if .bup/ is properly
excluded from the backup, but 'bup ls' will only show this if given
the -a switch.

Signed-off-by: Yung-Chin Oei <yungchin@yungchin.nl>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Fallbacks for missing GECOS data; this solves a test issue.

See the thread starting here:

  Subject: tests fail while trying to compile & install on arch linux
  Date: Sun, 20 May 2012 23:08:20 +0300
  From: Alper Kanat <tunix@raptiye.org>
  Message-ID: <CAPMuxnSmeHLcP=9M7uYPn6LQeCGNfZOF9DgCFQBHCzwR_DQ0Cg@mail.gmail.com>

When an entry for the current user has been successfully retrieved from the
Unix password database by the function:

  bup.helpers.usersfullname

then solely the GECOS field has been used to formulate an author's and
committer's full name for constructing a git commit object. Unfortunately,
this field may well be empty for a great many users; for such a user, the
result has been a full name that is the empty string.

This had not been a problem until the following commit was made in the course
of the development of `git' itself:

  commit 4b340cfab9c7a18e39bc531d6a6ffaffdf95f62d
  Author:     Junio C Hamano <gitster@pobox.com>
  AuthorDate: Sun Mar 11 01:25:43 2012 -0800
  Commit:     Junio C Hamano <gitster@pobox.com>
  CommitDate: Sun Mar 11 03:56:50 2012 -0700

      ident.c: add split_ident_line() to parse formatted ident line

      The commit formatting logic format_person_part() in pretty.c
      implements the logic to split an author/committer ident line into
      its parts, intermixed with logic to compute its output using these
      piece it computes.

      Separate the former out to a helper function split_ident_line() so
      that other codepath can use the same logic, and rewrite the function
      using the helper function.

      Signed-off-by: Junio C Hamano <gitster@pobox.com>

The new `split_ident_line()' function added by that commit is written
under the stricter assumption that the user's name is *not* the empty
string; clearly, this assumption is broken by what `bup' has been doing
when the user's GECOS field is empty.

Consequently, the easiest solution (as far as `bup' development is
concerned) is to make sure that the full name is never the empty
string. This is achieved by using fallbacks when the GECOS field
yields the empty string:

  0. The user's login name is tried.
  1. The string "user <uid>" is composed, where `<uid>' is the
     current process's user identifier.

Essentially, this seems to solve the problem, as it allows tests to
pass on my system. However, both:

  bup.helpers.username
  bup.helpers.usersfullname

still rely on Unix-specific functionality, which is not really acceptable.

Signed-off-by: Michael Witten <mfwitten@gmail.com>
Reviewed-by: Gabriel Filion <lelutin@gmail.com>
Tested-by: Zoran Zaric <zz@zoranzaric.de>
Change userfullname() default back to "user%d" for the moment.

This was changed in the previous GECOS patch, but since username() has
the "user%d" fallback too, I think we should change both, or neither,
and should probably discuss it a bit more first.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Calling bup-server with "-r host:" fails to activate dumb mode.

When no remote directory is supplied to the -r option, no set-dir
command is sent to the server. This has the weird side effect that the
server actually does not check whether it needs to be in "smart" or
"dumb" mode.

By forcing all commands to make that verification, we'll ensure that the
server mode is correct.

Signed-off-by: Yung-Chin Oei <yungchin@yungchin.nl>
Reviewed-by: Gabriel Filion <lelutin@gmail.com>
Reviewed-by: Zoran Zaric <zz@zoranzaric.de>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Fix GNU make detection and usage.

BSD make errors out since the Makefiles use GNU make specific code.
However, on BSD systems, 'make' is BSD make and not GNU make.

make(1) does set ${MAKE} to argv[0], so use this to pass the correct
make executable name down.

Also, prefer gmake to make, if it exists, since we want GNU make.

Signed-off-by: Thomas Klausner <tk@giga.or.at>
Tested-by: Gabriel Filion <lelutin@gmail.com>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Change a few Makefile vars using ${} to use $() to match the rest.

Also get rid of one annoying bright pink (in emacs) orphaned tab.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Enable the reflog when initializing the repository.

Avery noticed that this wasn't being done for bare repositories, so
ask for it explicitly.

Reported-by: Avery Pennarun <apenwarr@gmail.com>
Signed-off-by: Zoran Zaric <zz@zoranzaric.de>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
git.py: avoid repeated string-copying in tree_decode()

git.tree_decode showed bad perfomance when dealing with large trees,
because it required string-copying quadratically in the number of tree
elements. By removing unnecessary copying, performance is improved at
all tree sizes, and significantly so for larger trees.

The problem became particularly apparent in combination with another bug
in bup (patch for which forthcoming), that allowed trees to grow without
bound when backing up sparse files.

Reported-by: trebor <robert.rebstock@tempelhof-projekt.de>
Signed-off-by: Yung-Chin Oei <yungchin@yungchin.nl>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Implement a import-rdiff-backup command

Signed-off-by: Zoran Zaric <zz@zoranzaric.de>
Reviewed-by: Gabriel Filion <lelutin@gmail.com>
Add documentation for import-rdiff-backup

Signed-off-by: Zoran Zaric <zz@zoranzaric.de>
Reviewed-by: Gabriel Filion <lelutin@gmail.com>
Add a testcase for the import-rdiff-backup command

Signed-off-by: Zoran Zaric <zz@zoranzaric.de>
Reviewed-by: Gabriel Filion <lelutin@gmail.com>
Catch ^C in import-rdiff-backup

Signed-off-by: Zoran Zaric <zz@zoranzaric.de>
Reviewed-by: Gabriel Filion <lelutin@gmail.com>
Make import-rdiff-backup's output more verbose

Signed-off-by: Zoran Zaric <zz@zoranzaric.de>
Reviewed-by: Gabriel Filion <lelutin@gmail.com>