From patchwork Mon Jun 9 02:16:34 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 4317421 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 721339F357 for ; Mon, 9 Jun 2014 02:17:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9895A2015E for ; Mon, 9 Jun 2014 02:17:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B85152015D for ; Mon, 9 Jun 2014 02:17:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754256AbaFICRn (ORCPT ); Sun, 8 Jun 2014 22:17:43 -0400 Received: from smtp.mei.co.jp ([133.183.100.20]:53197 "EHLO smtp.mei.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753878AbaFICRm (ORCPT ); Sun, 8 Jun 2014 22:17:42 -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 s592Hem9018225; Mon, 9 Jun 2014 11:17:40 +0900 (JST) Received: from epochmail.jp.panasonic.com ([157.8.1.130]) by mail.jp.panasonic.com (8.11.6p2/3.7W/kc-maili15) with ESMTP id s592HeB08052; Mon, 9 Jun 2014 11:17:40 +0900 Received: by epochmail.jp.panasonic.com (8.12.11.20060308/3.7W/lomi15) id s592HeQI022751; Mon, 9 Jun 2014 11:17:40 +0900 Received: from poodle by lomi15.jp.panasonic.com (8.12.11.20060308/3.7W) with ESMTP id s592Hdoh022722; Mon, 9 Jun 2014 11:17:39 +0900 Received: from beagle.diag.org (beagle.diag.org [10.184.179.16]) by poodle (Postfix) with ESMTP id D4D062740043; Mon, 9 Jun 2014 11:17:39 +0900 (JST) From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Jason Cooper , Masahiro Yamada Subject: [PATCH v2 1/7] scripts: objdiff: get the path to .tmp_objdiff more simply Date: Mon, 9 Jun 2014 11:16:34 +0900 Message-Id: <1402280200-21834-2-git-send-email-yamada.m@jp.panasonic.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1402280200-21834-1-git-send-email-yamada.m@jp.panasonic.com> References: <1402280200-21834-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 Acked-by: Jason Cooper --- Changes in v2: None 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 "