From patchwork Fri May 30 11:11:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 4269771 Return-Path: X-Original-To: patchwork-linux-kbuild@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0E8CE9F1D6 for ; Fri, 30 May 2014 11:12:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0693D2038C for ; Fri, 30 May 2014 11:12:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2553420382 for ; Fri, 30 May 2014 11:12:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752843AbaE3LMH (ORCPT ); Fri, 30 May 2014 07:12:07 -0400 Received: from smtp.mei.co.jp ([133.183.100.20]:38175 "EHLO smtp.mei.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751919AbaE3LMH (ORCPT ); Fri, 30 May 2014 07:12:07 -0400 Received: from mail-gw.jp.panasonic.com ([157.8.1.157]) by smtp.mei.co.jp (8.12.11.20060614/3.7W/kc-maile11) with ESMTP id s4UBC1Gf009143; Fri, 30 May 2014 20:12:01 +0900 (JST) Received: from epochmail.jp.panasonic.com ([157.8.1.130]) by mail.jp.panasonic.com (8.11.6p2/3.7W/kc-maili12) with ESMTP id s4UBC3o10088; Fri, 30 May 2014 20:12:03 +0900 Received: by epochmail.jp.panasonic.com (8.12.11.20060308/3.7W/lomi16) id s4UBC32B004326; Fri, 30 May 2014 20:12:03 +0900 Received: from poodle by lomi16.jp.panasonic.com (8.12.11.20060308/3.7W) with ESMTP id s4UBC3Wt004288; Fri, 30 May 2014 20:12:03 +0900 Received: from beagle.diag.org (beagle.diag.org [10.184.179.16]) by poodle (Postfix) with ESMTP id 7E8DE2740043; Fri, 30 May 2014 20:12:03 +0900 (JST) From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , Jason Cooper Subject: [PATCH 1/7] scripts: objdiff: get the path to .tmp_objdiff more simply Date: Fri, 30 May 2014 20:11:49 +0900 Message-Id: <1401448315-800-2-git-send-email-yamada.m@jp.panasonic.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1401448315-800-1-git-send-email-yamada.m@jp.panasonic.com> References: <1401448315-800-1-git-send-email-yamada.m@jp.panasonic.com> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This commit is a minor refactoring. Temporary files for objdiff are stored in .tmp_objdiff directory which is located at the top directory. To get the path to this directory, SRCTREE=`git rev-parse --show-toplevel` TMPD=$SRCTREE/.tmp_objdiff seems easier to understand than GIT_DIR=`git rev-parse --git-dir` TMPD=${GIT_DIR%git}tmp_objdiff Besides, it is not always necessary to create .tmp_objdiff dicrectory. It should be created only for "record" command. Signed-off-by: Masahiro Yamada Cc: Jason Cooper --- scripts/objdiff | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/scripts/objdiff b/scripts/objdiff index b3e4f10..b8f7fc6 100755 --- a/scripts/objdiff +++ b/scripts/objdiff @@ -25,17 +25,15 @@ # # Note: 'make mrproper' will also remove .tmp_objdiff -GIT_DIR="`git rev-parse --git-dir`" +SRCTREE=$(git rev-parse --show-toplevel 2>/dev/null) -if [ -d "$GIT_DIR" ]; then - TMPD="${GIT_DIR%git}tmp_objdiff" - - [ -d "$TMPD" ] || mkdir "$TMPD" -else - echo "ERROR: git directory not found." +if [ -z "$SRCTREE" ]; then + echo "ERROR: Not a git repository." exit 1 fi +TMPD=$SRCTREE/.tmp_objdiff + usage() { echo "Usage: $0 " echo " record "