Skip to content

Instantly share code, notes, and snippets.

@yukihr
Last active January 2, 2016 17:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yukihr/8335649 to your computer and use it in GitHub Desktop.
Save yukihr/8335649 to your computer and use it in GitHub Desktop.
find out dated files for enja-oss/stylus
#!/bin/bash
ORIG_DIR='./stylus_orig'
CLONE_TO='git clone https://github.com/LearnBoost/stylus.git'
LIST_DOCS='git ls-tree --name-only HEAD docs/'
LAST_TIME='git log -1 --pretty=format:%ct'
LAST_TIME_F='git log -1 --pretty=format:%cr'
DEV=false
${CLONE_TO} ${ORIG_DIR} > /dev/null 2>&1
files=$(${LIST_DOCS})
orig_files=$(cd ${ORIG_DIR}; ${LIST_DOCS})
# TODO: fast implementation
for file in $files; do
time=$($LAST_TIME $file)
for orig_file in $orig_files; do
orig_time=$(cd $ORIG_DIR; $LAST_TIME $orig_file)
orig_time_f=$(cd $ORIG_DIR; $LAST_TIME_F $orig_file)
if [ $file = $orig_file ]; then
if [ $(echo "${time} < ${orig_time}" | bc) -ne 0 ]; then
printf "file:%s\tmodified_at:%s\n" $file "${orig_time_f}"
fi
fi
done
done
if [ $DEV = false ]; then
rm -rf ${ORIG_DIR}
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment