From 75b584a6f60fddaa341ad00abb0ecc9ed8adf822 Mon Sep 17 00:00:00 2001
From: Joey Hess <joey@gnu.kitenet.net>
Date: Thu, 18 Feb 2010 13:55:17 -0500
Subject: Record real committer username in the darcs log, so that the man page
 can say that for every VCS the username is recorded.

---
 commit.d/50vcs-commit | 5 ++++-
 debian/changelog      | 2 ++
 etckeeper.8           | 2 ++
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/commit.d/50vcs-commit b/commit.d/50vcs-commit
index 8a1ce3f..6cc0307 100755
--- a/commit.d/50vcs-commit
+++ b/commit.d/50vcs-commit
@@ -45,8 +45,11 @@ elif [ "$VCS" = bzr ] && [ -d .bzr ]; then
 		bzr commit "$BZR_AUTHOR" $BZR_COMMIT_OPTIONS
 	fi
 elif [ "$VCS" = darcs ] && [ -d _darcs ]; then
-	logfile="$( mktemp -t etckeeper-$VCS.XXXXXXXXXX )"
+	logfile="$(mktemp -t etckeeper-$VCS.XXXXXXXXXX)"
 	printf "%b" "$message" > "$logfile"
+	if [ -n "$USER" ]; then
+		echo "(committed by $USER)" >> "$logfile"
+	fi
 	darcs record $DARCS_COMMIT_OPTIONS --logfile="$logfile"
 	rm -f "$logfile"
 	unset logfile
diff --git a/debian/changelog b/debian/changelog
index cf69bc2..d4229db 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -9,6 +9,8 @@ etckeeper (0.43) UNRELEASED; urgency=low
   * Check owner of tty to determine who has su'd to root when committing,
     based on a patch by Jakov Sosic.
   * Add apparmor.d/cache/ to default ignores.
+  * Record real committer username in the darcs log, so that the man page
+    can say that for every VCS the username is recorded.
 
  -- Joey Hess <joeyh@debian.org>  Sun, 31 Jan 2010 14:36:44 -0500
 
diff --git a/etckeeper.8 b/etckeeper.8
index ec65f5b..7c05467 100644
--- a/etckeeper.8
+++ b/etckeeper.8
@@ -21,6 +21,8 @@ initialise a clone of the /etc repository located elsewhere.
 .B commit [message]
 Commits all changes in /etc to the repository. A commit message can be
 specified. You may also use the underlying VCS to commit manually.
+(Note that etckeeper commit will notice if a user has used sudo or su to
+become root, and record the original username in the commit.)
 .TP
 .B pre-commit
 This is called as a pre-commit hook. It stores metadata and does sanity
-- 
cgit v1.2.3