이번에 하나의 파일과 연관되어 있는 많은 패치를 분석하게 되어 필요해서 조사해본 git 커맨드 입니다.
패치를 코드 수정량 관점에서 볼때 효과적으로 사용할 수 있을 것 같아요!
git log --oneline --shortstat --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cs) %C(bold blue)<%an>%Creset' --abbrev-commit --before="2019-05-20" --after="2008-10-01" --full-diff mm/vmscan.c
재미있는 점은, full-diff 의 인자로 파일명을 넣어줘야 다른 파일을 포함한 라인 수를 확인 가능하다는 점입니다.
(깃허브 히스토리에서 커밋 내역별로 보여주는 기능이랑 유사)
포맷은 https://git-scm.com/docs/git-log#Documentation/git-log.txt-emHem
에 나와있는 인자로 보기 편하신대로 바꿀수 있네요.
git log --oneline --shortstat --pretty=format:'@ %Cred%h%Creset %Cgreen(%cs) %C(yellow)%d%Creset %s %C(bold blue)<%an>%Creset' --abbrev-commit --before="2019-05-20" --after="2008-10-01" --full-diff mm/vmscan.c | awk '$4 > 100 {print ;}' | tr "\n" " " | tr "@" "\n" | grep insertions
--before="2019-05-20" --after="2008-10-01" 기간 내에서
awk 커맨드로 insertions 가 100 줄 이상되어 있는 커밋들을 찾아냅니다.
앞으로 자주 쓰일것 같은데, 아쉽게도 git log 에서 라인 카운트로 필터링 기능이 안 보이네요.
제가 보기 편하게끔 포맷을 맞춰서 커맨드가 길어졌는데, 편하신대로 수정하셔도 재미있을 것 같아요!
긴 글 읽어주셔서 감사합니다.
참고
https://stackoverflow.com/questions/21137477/how-to-get-git-log-with-short-stat-in-one-line
댓글 2
-
이파란
2021.09.05 12:44
-
이파란
2022.06.05 16:17
~/ubuntu-focal$ git ls-files | grep ".patch"
Documentation/ABI/testing/sysfs-kernel-livepatch
Documentation/devicetree/bindings/submitting-patches.txt
Documentation/hwmon/submitting-patches.rst
Documentation/livepatch/callbacks.rst
Documentation/livepatch/cumulative-patches.rst
Documentation/livepatch/index.rst
Documentation/livepatch/livepatch.rst
Documentation/livepatch/module-elf-format.rst
Documentation/livepatch/shadow-vars.rst
Documentation/powerpc/vcpudispatch_stats.txt
Documentation/process/applying-patches.rst
Documentation/process/submitting-patches.rst
Documentation/translations/it_IT/process/applying-patches.rst
Documentation/translations/it_IT/process/submitting-patches.rst
Documentation/translations/zh_CN/process/submitting-patches.rst
arch/arm/include/asm/patch.h
arch/arm/kernel/patch.c
arch/ia64/include/asm/native/patchlist.h
arch/ia64/include/asm/patch.h
arch/ia64/kernel/patch.c
arch/parisc/include/asm/patch.h
arch/parisc/kernel/patch.c
arch/parisc/math-emu/fpudispatch.c
arch/powerpc/include/asm/code-patching-asm.h
arch/powerpc/include/asm/code-patching.h
arch/powerpc/include/asm/livepatch.h
arch/powerpc/lib/code-patching.c
arch/powerpc/platforms/8xx/micropatch.c
arch/powerpc/tools/checkpatch.sh
arch/s390/include/asm/livepatch.h
arch/sparc/lib/GENpatch.S
arch/sparc/lib/M7patch.S
arch/sparc/lib/NG2patch.S
arch/sparc/lib/NG4patch.S
arch/sparc/lib/NGpatch.S
arch/sparc/lib/U3patch.S
arch/x86/include/asm/livepatch.h
arch/x86/include/asm/text-patching.h
arch/x86/kernel/livepatch.c
arch/x86/kernel/paravirt_patch.c
debian/certs/canonical-livepatch-all.pem
debian/commit-templates/sauce-patch
debian/commit-templates/upstream-patch
drivers/media/pci/ttpci/budget-patch.c
include/linux/livepatch.h
include/linux/patchkey.h
include/uapi/linux/patchkey.h
kernel/livepatch/Kconfig
kernel/livepatch/Makefile
kernel/livepatch/core.c
kernel/livepatch/core.h
kernel/livepatch/patch.c
kernel/livepatch/patch.h
kernel/livepatch/shadow.c
kernel/livepatch/transition.c
kernel/livepatch/transition.h
lib/livepatch/Makefile
lib/livepatch/test_klp_atomic_replace.c
lib/livepatch/test_klp_callbacks_busy.c
lib/livepatch/test_klp_callbacks_demo.c
lib/livepatch/test_klp_callbacks_demo2.c
lib/livepatch/test_klp_callbacks_mod.c
lib/livepatch/test_klp_livepatch.c
lib/livepatch/test_klp_shadow_vars.c
samples/livepatch/Makefile
samples/livepatch/livepatch-callbacks-busymod.c
samples/livepatch/livepatch-callbacks-demo.c
samples/livepatch/livepatch-callbacks-mod.c
samples/livepatch/livepatch-sample.c
samples/livepatch/livepatch-shadow-fix1.c
samples/livepatch/livepatch-shadow-fix2.c
samples/livepatch/livepatch-shadow-mod.c
scripts/checkpatch.pl
scripts/cleanpatch
scripts/const_structs.checkpatch
scripts/patch-kernel
sound/isa/sb/emu8000_patch.c
sound/pci/ac97/ac97_patch.c
sound/pci/ac97/ac97_patch.h
sound/pci/emu10k1/emu10k1_patch.c
sound/pci/hda/patch_analog.c
sound/pci/hda/patch_ca0110.c
sound/pci/hda/patch_ca0132.c
sound/pci/hda/patch_cirrus.c
sound/pci/hda/patch_cmedia.c
sound/pci/hda/patch_conexant.c
sound/pci/hda/patch_hdmi.c
sound/pci/hda/patch_realtek.c
sound/pci/hda/patch_si3054.c
sound/pci/hda/patch_sigmatel.c
sound/pci/hda/patch_via.c
tools/testing/ktest/examples/include/patchcheck.conf
tools/testing/selftests/livepatch/Makefile
tools/testing/selftests/livepatch/README
tools/testing/selftests/livepatch/config
tools/testing/selftests/livepatch/functions.sh
tools/testing/selftests/livepatch/test-callbacks.sh
tools/testing/selftests/livepatch/test-livepatch.sh
tools/testing/selftests/livepatch/test-shadow-vars.sh
.
# mm/vmscan.c::shrink_page_list() 함수 필터까지 걸었을 경우 (라인수는 필터 안 걸음)
$ git log --oneline --shortstat --pretty=format:'@ %Cred%h%Creset %Cgreen(%cs) %C(yellow)%d%Creset %s %C(bold blue)<%an>%Creset' --abbrev-commit --before="2019-05-20" --after="2008-10-01" -G shrink_page_list mm/vmscan.c > ~/commit.txt