aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Neto <dneto@google.com>2022-12-09 12:17:52 -0500
committerGitHub <noreply@github.com>2022-12-09 12:17:52 -0500
commit226d2a5f3c03df42957ee408769370b11a51026a (patch)
tree1da8a5f8c839285e84e359cde5b81ef1a414b6f0
parentd890d83cecfea8483e07331f3a86fb040778b7de (diff)
downloadamber-226d2a5f3c03df42957ee408769370b11a51026a.tar.gz
git-sync-deps: show the tail, not the head of what's being checked out (#1004)
* git-sync-deps: show the tail, not the head of what's being checked out This is more informative when in a deep path. * Put the '...' at the front, not the end
-rwxr-xr-xtools/git-sync-deps8
1 files changed, 4 insertions, 4 deletions
diff --git a/tools/git-sync-deps b/tools/git-sync-deps
index 3090588..0a544d6 100755
--- a/tools/git-sync-deps
+++ b/tools/git-sync-deps
@@ -116,11 +116,11 @@ def is_git_toplevel(git, directory):
def status(directory, checkoutable):
- def truncate(s, length):
- return s if len(s) <= length else s[:(length - 3)] + '...'
+ def tail_truncate(s, length):
+ return s if len(s) <= length else '...' + s[-(length - 3):]
dlen = 36
- directory = truncate(directory, dlen)
- checkoutable = truncate(checkoutable, 40)
+ directory = tail_truncate(directory, dlen)
+ checkoutable = tail_truncate(checkoutable, 40)
sys.stdout.write('%-*s @ %s\n' % (dlen, directory, checkoutable))